Hello, I'm trying to make a localscript about saving cards. When you die, it saves the cards into a table which is then accessed when you respawn and it gives your cards back. However, I can't get the player.CharacterAdded event to work at all. It's not firing when you join or when you die. The first part of the script works fine, it's just the CharacterAdded part that is not working. I'm getting quite frustrated, so I hope someone could please help.
local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:Wait() local died = false char:WaitForChild("Humanoid").Died:Connect(function() died = true cardtable = {} for i,v in pairs(script.Parent.Inventory:GetChildren()) do if v.Name ~= "UIGridLayout" then table.insert(cardtable,v.Name) end end end) player.CharacterAdded:Connect(function(char) print("Added") --never prints if died == true then for i,v in pairs(cardtable) do local newcard = game.ReplicatedStorage.Cards:FindFirstChild(v):Clone() newcard.Parent = script.Parent.Inventory end died = false end end)