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.

4 comments
can we see the structure of script.Parent?
It's all good, I solved it. But the second if statement isn't running. I can't figure out why. The S1 variable path just links to a part in the workspace.
^ Figured that out also, just needed to change it to S1.Position. But now I just need to figure out how to make the character teleport instead of walking over. I basically solved my own question.
S1 isn't declared as a variable.