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

Players not spawning in correct place after respawning?

Asked by
trecept 367 Moderation Voter
6 years ago
game:GetService("Players").PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char)
        char:FindFirstChild("HumanoidRootPart").CFrame = SpawnValues[math.random(1, #SpawnValues)]
    end)
end)

(SpawnValues is a table with the cframes of certain parts I want the player to spawn at) This script works fine in roblox studio, but in game it doesn't work? I don't want to use a spawnlocation part since I want the player when they join to spawn in the lobby, then later for them to spawn somewhere else.

0
Make sure that this is in a server script, not a localscript. LeadRDRK 437 — 6y
0
Yep, it's in a server script trecept 367 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

It is because the humanoidrootpart has wrong CFrame. I am not ENTIRELY sure of that...but I think that is the reason.

0
With "wrong" I meant resetted (because when you die CFrame values are changed) Fragmentation123 226 — 6y
0
uhh, yes CFrame values are changed when you die, but he has already connected the characteradded event, means that it will reposition itself when respawned. LeadRDRK 437 — 6y
0
this wouldn't exactly explain why it works in studio but not in game though trecept 367 — 6y
Ad

Answer this question