I am mid way through creating some code which teleports a player (using torso CFrame) when they join the game, the code works fine in single player mode (Test mode) however it does not seem to move the player, the code after it is executed because the player is frozen in the air. I have tried adding a wait before the CFrame move movement but it don't seem to work. Here is the code:
game.Players.PlayerAdded:connect(function( player )
print(player.Name ..tostring(" has joined"))
repeat wait() until player.Character.Torso
if player.Character and player.Character:FindFirstChild("Torso") then
local character = player.Character
print("Moving character")
character.Torso.CFrame = CFrame.new(game.Workspace.Pod1.Podbase.Position + Vector3.new(0,4.5,0))
character.Torso.Anchored = true
if character.ForceField then
character.ForceField:Destroy()
end
wait(0.1)
script.CameraScript:clone().Parent = character
end
end)
