Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is wrong with my math.random-Teleport script?

Asked by 4 years ago

So I am trying to add different gamemodes to my game by using a math.random then teleport script. However, when I look at the script, my value is not working. It is underlined orange. What is wrong here?

while wait(math.random(3,5)) do
local numb = math.random(1,2)
print(numb)
end



while true do

 wait(1)
 seconds.Value = seconds.Value - 1

if seconds.Value == 0 and ingame == 0 and numb == 1 then

 ingame = 1
 seconds.Value = 90

 local teleport = game.Players:GetChildren()
for i = 1, #teleport do
teleport[i].Character:MoveTo(Vector3.new(Game.X, Game.Y, Game.Z))

if seconds.Value == 0 and ingame == 0 and numb == 2 then

 ingame = 1
 seconds.Value = 90

 local teleport = game.Players:GetChildren()
for i = 1, #teleport do
teleport[i].Character:MoveTo(Vector3.new(Game2.X, Game2.Y, Game2.Z))

end
end
end
end
end

I would also like to say that due to me being terrible at scripting, most of this is from a tutorial video.

0
Where is the orange underline located? Xapelize 2658 — 4y
0
What’s the output? raid6n 2196 — 4y
0
It's under numb and no output. Script just entirely doesn't work. CreatorOfStuff2001 25 — 4y
0
you cant have multiple loops after each other by the way because the first one will just keep going - also the math.random part shouldnt be erroring at all because it looks correct. Im not sure what you mean by there being an orange line - is it in the script editor or output? xEiffel 280 — 4y
0
script editor CreatorOfStuff2001 25 — 4y

Answer this question