Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why wont the players character teleport?

Asked by 4 years ago

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)
0
Local or serversided? voidofdeathfire 148 — 4y

1 answer

Log in to vote
1
Answered by
Syclya 224 Moderation Voter
4 years ago

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.

0
thanks that helps ReallyUnikatni 68 — 4y
0
You're welcome c: Hope you figure it out! Syclya 224 — 4y
Ad

Answer this question