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

How to fix that Teleportation script?

player.CharacterAdded:Connect(function(character)
	
        local Humanoid = character:WaitForChild("Humanoid")
        local Torso = character:WaitForChild("HumanoidRootPart")
       
        wait()
       
        if Torso and Humanoid then
            if Stage.Value ~= 0 then
               
                local StagePart = workspace.Stages:FindFirstChild(Stage.Value)
                Torso.CFrame = CFrame.new(StagePart.Position + Vector3.new(0,1,0))               
        end
    end
end)   

There's no error message in the output and it does not teleport me

Thanks for helping!

2 comments

0

it looks like stage isn't defined anywhere, so the script can't find stage.Value if there's no stage

0

there is, its just a part of the script but i need to fix line 11-12, it does not tp me when i join but does it when i reset myself then respawn.

1 answer

Looking at your reply, I'm pretty sure the reason it doesn't teleport you when you join is because you only use CharacterAdded and not both CharacterAdded and PlayerAdded

Try this:

function teleport(char)
local Humanoid = char:WaitForChild("Humanoid")
	        local Torso = char:WaitForChild("HumanoidRootPart")
	 
	        wait()
	 
	        if Torso and Humanoid then
	            if Stage.Value ~= 0 then
	 
 local StagePart = workspace.Stages:FindFirstChild(Stage.Value)
Torso.CFrame = CFrame.new(StagePart.Position + Vector3.new(0,1,0))              
	        end
	    end
end

function PlayerEntered(newPlayer)
newPlayer.CharacterAdded:Connect(teleport)
end

game.Players.PlayerAdded:Connect(PlayerEntered)

2 comments

0

It doesn't work, add me on discord (52#0116) so i can send you the full script

0

sent

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