Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Player teleport not working?

--Teleport all the players
function teleportPlayers()
  for i,v in pairs(players) do
--will be together in script
    v.Character.HumanoidRootPart.CFrame =     
currentmap:FindFirstChild(chosenmap.Value).Spawn * CFrame.new(math.random(5,10),0,math.random(5,10))
--will be together in script_
  end
end

Here is the part of the script that is giving me problems. It will not teleport. NOTE:

1 answer

✓ Accepted answer

Try this:

--Teleport all the players
function teleportPlayers()
  for i,v in pairs(players) do
--will be together in script
    v.Character.HumanoidRootPart.CFrame = CFrame.new(currentmap:FindFirstChild(chosenmap.Value).Spawn * CFrame.new(math.random(5,10),0,math.random(5,10)))
--will be together in script_
  end
end

2 comments

0

I thought this code would work but for some reason it still dosnt teleport the player

0

I edited this script and got it working! target = CFrame.new(0, 50, 0) --could be near a brick or in a new area for i, player in ipairs(game.Players:GetChildren()) do --Make sure the character exists and its HumanoidRootPart exists if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then --add an offset of 5 for each character player.Character.Humanoid

This discussion is preserved as it was. New answers, comments, and votes are closed.