This is my damage script to my fire ball tool and it works with the damage but when I try to add it so that if the Player kills another person their Exp stat in the leader board raises the damage still works but the Exp stat in leader board doesn't raise. I used the Variable PlayerName to find the name of the Player in the Players Folder so I can access the player
PlayerName = script.Parent.Parent.Parent.Name function onDamage(Part) if Part.Parent:FindFirstChild("Humanoid") ~= nil and Part.Parent.Name ~= "script.Parent.Name" then script.Disabled = true f = Instance.new("Fire", Part) for i = 1,25 do f.Size = f.Size +0.25 Part.Parent.Humanoid.Health = Part.Parent.Humanoid.Health -1 wait(0.05) end Part.Parent.Humanoid.Sit = true if Part.Parent.Humanoid.Health <= 0 then game.Players.PlayerName.leaderstats.Exp = game.Players.PlayerName.leaderstats.Exp +1 end f:remove() script.Parent:remove() end wait(0.025) end script.Parent.Touched:connect(onDamage)
Line 4, is the part possibly named script.Parent.Name? If not, remove the quotations and it should work fine. I don't see any other clear errors
game.Players.LocalPlayer.leaderstats.Exp = game.Players.LocalPlayer.leaderstats.Exp +1
On line 5, you disable the script. That's why nothing happens.