Refresh character on join

I was wondering how would i go about making a refresh player script on join. For example A player joins, the script automatically refreshes their character that one time.

1 Like

To respawn/refresh someones character you can use Player:LoadCharacter() on their player object. Here is an example of how it can be used:

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
    player:LoadCharacter() -- load the character for the first time
end)

I’m assuming you want to respawn a player’s character after their character has been spawned for the first time. I’m unsure why you would want to do this, but here is how you would do it:

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Wait() -- wait for their character to be added for the first time
    player:LoadCharacter() -- respawn their character
end)
2 Likes

Would i put this in workspace or serverscriptservice or starterplayer>StarterCharacterScripts or StarterPlayerScripts

This would go in a server script in the ServerScriptService.

cant seem to get it to respawn my character, how would i go about adding a wait after they spawn then refresh them?

By using wait() you can add a delay before your code continues. Here is how you could add a 1 second delay:

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Wait() -- wait for their character to be added for the first time
    wait(1)
    player:LoadCharacter() -- respawn their character
end)
5 Likes

Thank you so much! This seem to have worked!