I was trying to make a script that teleported my character to a certain location after I spawn or re spawned , I made it a local script and placed it on Starter player scripts. It had no errors but it didn't work
player = game.Players.LocalPlayer
char = player.character
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
char.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(14.3, 0.6, -105.4))
end)
end)
This is what I have now.
If I run just the code
char.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(14.3, 0.6, -105.4))
It works but just once not when I respawn

3 comments
And this is a local script right?
put it instead in StarterCharacterScripts
Make sure you connect CharacterAdded function even if the player joins before the PlayerAdded event is connected.