Hi, I wanted to make a script where it destroys certain objects inside a player's character when they die but I can't seem to figure it out.
Here's my script:
game.Players.PlayerAdded:Connect(function(blr) blr.CharacterAdded:Connect(function(jar) jar:WaitForChild("Humanoid").Died:Connect(function() if jar:FindFirstChildOfClass("Humanoid"):FindFirstChild("CanBeSeen") and jar:FindFirstChild("seen") then jar:FindFirstChildOfClass("Humanoid"):FindFirstChild("CanBeSeen"):Destroy() jar:FindFirstChild("seen"):Destroy() end end) kenactive(jar) print(blr.Name) end) end)
and yes, I did some searching and found out that you can't use playeradded in a localscript so I tried childadded and it still didn't work.