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

Teleporting and time question?

Asked by 10 years ago

Okay, I may not explain this correctly, so stay with me. In a hide and seek game [this is an example], one person is randomly chosen as a seeker. Then all players teleport to the map and hide. The seeker meanwhile is in the lobby waiting for the amount of time to run out so he can teleport to the map and find the hiders. So my questions are 1] How do I make it that it randomly chooses a seeker and teleports all players to the map? 2] How do I make it that there's an amount of time until the seeker is teleported to the area? Sorry if I added too many questions :P I probably should have broken this into multiple questions. :3

1 answer

Log in to vote
0
Answered by
Noculus 25
10 years ago

To randomly choose a seeker you would do this:

Players = game.Players:GetChildren()
Seeker = Players[math.random(1,#Players)]

Then... To wait:

for i=1,#Players do
    if Players[i].Name~=Seeker.Name then
        Players[i].Character.Torso.Position = TeleportPosition --Whatever your teleporting to
        end
end
wait(However long)
Seeker.Character.Torso.Position = TeleportPosition --Wherever you want your seeker to go

I hope this helps :)

0
THANK YOU! :D :D :D catsgalore01 5 — 10y
0
No problem :P Noculus 25 — 10y
Ad

Answer this question