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

Why wont the players character teleport?

I am trying to teleport a player to a certain position when spawning by using a script. It does everything except teleport.

player.CharacterAdded:Connect(function(char)
	
	char:WaitForChild("Humanoid")
	
	char.Humanoid.Torso.CFrame = CFrame.new(0,-1245,0)
	char.Humanoid.WalkSpeed = 0
	char.Humanoid.JumpPower = 0
	char.Head.BrickColor = BrickColor.new("Bright yellow")
	char["Left Arm"].BrickColor = BrickColor.new("Bright yellow")
	char["Right Arm"].BrickColor = BrickColor.new("Bright yellow")
	char.Torso.BrickColor = BrickColor.new("Electric blue")
	char["Left Leg"].BrickColor = BrickColor.new("Shamrock")
	char["Right Leg"].BrickColor = BrickColor.new("Shamrock")
	
	local ForceField = Instance.new("ForceField")
	ForceField.Visible = false
	ForceField.Parent = char
	
	local healthScript = char:WaitForChild("Health")
	healthScript:Destroy()
	
	events.GameLoaded:FireClient(player)
	
end)

1 comment

0

Local or serversided?

1 answer

✓ Accepted answer

There’s some kind of weird delay between the character getting parented and the character actually being move-able. I wouldn’t recommend CFraming the player’s position on the server. What could happen is the client may send a packet to the server giving position information for their avatar, which could then override the server’s position.

Teleport the player on the client when they spawn, so that it’s more guaranteed that the player will be at that position.

2 comments

0

thanks that helps

0

You're welcome c: Hope you figure it out!

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