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

How can I fix this glitchy respawn? (Hard to explain in a title)

Hello! I'm making an obby. Whenever a player dies, the player seems to generate at the neutral spawnpoint, before spawning at their checkpoint a split second later. It's a small problem but it really bugs me.

This video should give you a better understanding with what I mean: https://imgur.com/3f1RZUE

How can I fix this?

4 comments

0

This happen because you not really set spawn location of the Player. Mean, when the Player die, they will spawn at the neutral spawnpoint and instantly teleport to the last check point. Maybe that is the cause of glitchy respawn.

0

You can use Player.RespawnLocation to set respawn location of the Player https://developer.roblox.com/api-reference/property/Player/RespawnLocation

0

This doesn't seem to work, I still have the same problem.

0

Check my answer out again

1 answer

Hello! So just set the player's respawn location to the location of your checkpoint. Here is an example:

local point = workspace.Spawnpoint1 -- The name of your checkpoint

point.Touched:Connect(function(hit)
       if hit.Parent then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent);
        if player then
	player.RespawnLocation = point
       end
       end
end)

OR


local point = workspace.Spawnpoint1 -- The name of your checkpoint

point.Touched:Connect(function(hit)
       if hit.Parent then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent);
        if player then
	player.RespawnLocation = point.Position
       end
       end
end)

Try both of those, Hope it helps!

4 comments

0

It says that "player" is an unknown global.

0

Oops, here let me edit it

0

Ok, view it again.

0

Sorry, this doesn't seem to solve the problem.

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