0
votes

I'm making a place in roblox. And i wrote script, Look at it, and please, say what wrong with it??? In another scripts all works perfectly!, you can help me with it?

    local players = game.Players:GetChildren()
    local pupil = players[math.random(0,#players)]
    local James = game.Workspace.James
    local Texte = game.StarterGui.ScreenGui.Maintexzt
    local nameq = game.StarterGui.ScreenGui.Maintexzt.Nameq
    function ontouch(hit)
    if hit.Parent:findFirstChild("Humanoid") then
    print("Trigget working!")
    James.Humanoid.Torso.CFrame = game.Workspace.OutOfhere.CFrame
    script.Parent.CFrame = game.Workspace.SpawnLocation.CFrame
end
end
    script.Parent.Touched:Connect(ontouch)
    function ontouchexit()
Texte.Text = "Uh... We did it??"
wait(2)
nameq.Text = players.Name
Texte.Text = "Oh how we make it?"
wait(2)
nameq.Text = James.Name
Texte.Text = "Better, go home!"
wait(3)
nameq.Text = players.Name
Texte.Text = "Go!"
nameq.Text = James.Name
Texte.Text = "But go to my home!"
nameq.Text = players.Name
Texte.Text = "Nope"
nameq.Text = James.Name
Texte.Text = "Your choice, Your die, You can follow me, or not"
end
script.Parent.TouchEnded:Connect(ontouchexit)

and please, say what wrong with it, I want to finish a develop the place.

1
Which line the error is generated at? - Egor Skriptunoff
Welcome to StackOverflow. Please take your time and read Help Center - Asking. Most of the problems like yours can be easily avoided by reading the error you have got and giving it some thought. This means that if you want our help - send us the full error message including line number and related code. - Green

1 Answers

0
votes
local players = game.Players:GetChildren()

https://developer.roblox.com/en-us/api-reference/function/Instance/GetChildren

Returns an array (a numerically indexed table) containing all of the Instance's direct children

nameq.Text = players.Name

Not being a Robolox expert I find it very unlikely that players.Name is anything but nil

Your code further suggests that assigning vlaues to those Text properties will call some function. That would explain the error message to me.

I don't think an array of players would say "Uh... We did it??" So I guess the solution to your problem is to find out who you actually want to talk and use that name.

Print players.Name and see for yourself.