-- Script 1 local ReplicatedStorage = game:GetService('ReplicatedStorage') local Swords = ReplicatedStorage:FindFirstChild('Swords') game.Workspace.ChildAdded:connect(function(plr) if plr:IsA("Player") then local RewarableScript = script:WaitForChild('Rewardable') RewarableScript:Clone().Parent = plr plr:FindFirstChild('Rewardable').Disabled = false end end) -- Script 2 local Humanoid = script.Parent.Humanoid function Death() local tag = Humanoid:findFirstChild("creator") if tag ~= nil then if tag.Value ~= nil then local leaderstats = tag.Value:findFirstChild("leaderstats") if leaderstats ~= nil then leaderstats.Lvl.Value = leaderstats.Lvl.Value + 1 wait(0.1) script:remove() end end end end Humanoid.Died:connect(Death)
I don't know what you were trying to accomplish, so I just rewrote the format for you so you can do what you want with it:
local ReplicatedStorage = game:GetService('ReplicatedStorage') local Swords = ReplicatedStorage:FindFirstChild('Swords') game.Players.PlayerAdded:connect(function(Player) -- Everytime a player joins the game, set up these connections -- Create leaderstats here Player.CharacterAdded:connect(function(Character) -- Stuff you do every time the Player respawns Character:WaitForChild("Humanoid").Died:connect(function() -- Stuff you do every time the Player dies local tag = Humanoid:FindFirstChild("creator") if tag and tag.Value then local leaderstats = tag:FindFirstChild("leaderstats") if leaderstats then leaderstats.Lvl.Value = leaderstats.Lvl.Value + 1 end end end) end) end)