function Teleport(hit) if hit and hit.Parent:FindFirstChild("Humanoid") == true then script.Parent.Number.Value = math.random(1,8) if script.Parent.Number.Value == 1 then hit.Parent.Humanoid:MoveTo(S1) end end end script.Parent.Touched:connect(Teleport)
I'm making this code where whenever a player touches this part that this script is connected to, it'll choose a random number and depending on what number it lands on it will decide which spawn they'll go to. I went to test it before connecting the rest of the spawns to their own #, but I realized whenever I touch the part that is supposed to teleport you to one of the spawn points it doesn't even randomize (change) the IntValue that's supposed to decide the number.
There are no errors in the output, so I have no idea why it's not running.
Figured it out. All I needed to do was remove the:
== true
part of the code and it ran fine. I also made it an anonymous function, but I'm not sure if I needed to do that for it to run.