✓ Accepted answer
This is the EXACT code I've used in one of my games before. I only added comments to make it easier to understand what's going on.
game.Players.CharacterAutoLoads = false
game.Players.PlayerAdded:connect(function(player)
local function checkChild(child)
if child:isA("CharacterMesh") then
repeat wait() until child.Parent
child:remove()
end
end
local function characterSpawned(character)
for _, child in pairs(character:children()) do
checkChild(child)
end
character.ChildAdded:connect(checkChild)
character:WaitForChild("Humanoid").Died:connect(function()
wait(5)
player:LoadCharacter()
end)
end
player.CharacterAdded:connect(characterSpawned)
wait()
player:LoadCharacter()
end)
1 comment
Check edit on answer. Post comment on my answer when you see it.