I have trying to clone character before it got deleted.
but when i try to clone character and change parent there are error like my clone is nil
This is script i used on server side
plr.CharacterRemoving:Connect(function(me)
local clonechar = me:Clone()
if game.ServerStorage.Backup:FindFirstChild(plr.Name) then
game.ServerStorage.Backup:FindFirstChild(plr.Name):Destroy()
end
clonechar.Parent = game.ServerStorage.Backup
end)
Oh yea I had this error before you destroyed the backpack so cloning it or anything else wouldn’t be a option ! instead of :Destroy() :ClearAllChildren()
Nope! So look when I was making if you had a gun and chose a new the gun would be destroyed! Meaning it’s impossible to clone because it’s gone! So instead of :Destroy do :ClearAllChildren not hard
Characters, by default, don’t have Archiveable=true. IIRC, Clone doesn’t work with things that aren’t set to Archiveable.
me.Archiveable = true
local clonechar = me:Clone()
plr.CharacterRemoving:Connect(function(me)
local clonechar = me:Clone()
clonechar.Parent = game.ServerStorage.Backup
if game.ServerStorage.Backup:FindFirstChild(plr.Name) then
game.ServerStorage.Backup:FindFirstChild(plr.Name):ClearAllChildren()
end
I think it is archaic. People used to edit their games as a character rather than in Studio, and if you saved your game wile Archiveable is true, your character would be saved, and that’s bad. So characters default to non-archiveable so characters don’t accidentally get saved.
game.Players.PlayerAdding:Connect(function(plr)
plr.CharacterRemoving:Connect(function(me)
local clonechar = me:Clone()
if game.ServerStorage.Backup:FindFirstChild(plr.Name) then
game.ServerStorage.Backup:FindFirstChild(plr.Name):Destroy()
end
clonechar.Parent = game.ServerStorage.Backup
end)
game.Players.PlayerAdding:Connect(function(plr)
plr.CharacterRemoving:Connect(function(me)
local clonechar = me:Clone()
clonechar.Parent = game.ServerStorage.Backup
if game.ServerStorage.Backup:FindFirstChild(plr.Name) then
game.ServerStorage.Backup:FindFirstChild(plr.Name):Destroy()
end
end)