I’m trying to grab the players character when they leave the game so I can get what tools they have equipped and their position. However, it seems as if both character removing and player removing do not allow you to do this, as the character is nil by the time I try and clone it / access it. Is there a way to make player characters stick around longer, or to access its information regardlesss of if it still exists or not?
I can’t test rn, so if you can’t get the character in the PlayerRemoving then you should store a cloned version of the character in a a ReplicatedStorage folder (update the model when something changes) then upon PlayerRemoving do what you gotta do, then
Destory() that model
game.Players.PlayerRemoving:Connect(function(player) player.CharacterRemoving:Connect(function(character) -- your code here -- end) end)
You can use the method @CryoPlaysAlot told you about or you can use the childremoved:
local pos game.Workspace.ChildRemoved:Connect(function(child) if not child:IsA("Model") then return end if child:FindFirstChild("HumanoidRootPart") then pos = child:FindFirstChild("HumanoidRootPart").Position -- find other stuff like backpack tools here end end)
I’m not sure if this will work since I couldn’t test it but give it a try. I think that characterremoving is still better.
I do recommend that approach, however, I didn’t mention it because:
So idk, maybe OP used it wrong
Cache each player’s characters inside a table.