Random teleports

Hello!

i need help with a script that teleports you to a map filled with different teleport part location each time you die or when the round script says so. Any help with this is appreciated, but full scripts are not needed.

Use a for loop to iterate through the players and teleport their characters to different teleport points

1 Like

Some pseudo code to give you a direction

local Players = game:GetService:("Players")

local map = workspace.MapName

function TeleportPlayers(Map)
   local TeleportPads = Map.TeleportPads:GetChildren()

   for i, player in pairs(Players:GetPlayers()) do
      local NumberChooser = math.random(1,#TeleportPads)

      local character = player.Character or player.CharacterAdded:Wait()
      character:PivotTo(TeleportPads[NumberChooser].CFrame)
   end
end

TeleportPlayers(map)
1 Like

Something like this should work for teleporting players whenever they die

local Players = game:GetService("Players")
local TPParts = {
    workspace.TPLocation1,
    workspace.TPLocation2,
    workspace.TPLocation3
    -- Put however many of these you want
}

Players.PlayerAdded:Connect(function(Plr)
    Plr.CharacterAdded:Connect(function(Char)
        local Root = Char:WaitForChild("HumanoidRootPart")
        local RNG = math.Random(#TPParts)
        local Part = TPParts[RNG]
        Root.Position = Part.Position
    end)
end)
1 Like

I see. Good idea. Thank you, im detirmened this will work.

Not exactly what im looking for but thank you. It functions when players join. I need it when i want it to activate. Thanks!

Works pretty well! Just a quick question: How would i make this to where when player died, they spawn there again?

When you teleport a player to a random pad, add the number that the random number generator chose to teleport the player into an array or dictionary, and when the player dies see if they have an entry in the dictionary and instead teleport them there on respawn

You shouldn’t ask for full scripts in this forum

you should read the forum rules first before asking.

1 Like

I wasn’t exactly trying to get exact scripts. I was trying to get help. Ill clarify my post more. Thank you.

Ok, no problem. you can just advise that you need an idea to do that, not scripts

1 Like

I have fixed my topic the correct way, thank you for correcting it.

1 Like

Alright, ill mark you as solution as this did solve my issue.

I’m pretty sure you can set player respawn location from a script. That will probably solve your second issues:

1 Like

Hey, im having another issue with this. So it does work once. i need it to work mutiple times until a certain timer is up. Any thoughts?