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

Why does this work in single player but not when published?

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)

1 answer

Have been checking the wiki, cant seem to find any solutions...

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