I put the script in a Zombie that gets cloned into workspace its in a regular script I also tried it in a local script but it didn't work does anyone know whats wrong?
local player = game.Players.LocalPlayer local leaderstats = player:FindFirstChild("leaderstats") local kill = leaderstats.Kills.Value if script.Parent.Health == 0 then do kill.Value = kill.Value + 1 end end
First you called value 2 times, and 2nd you can't use .value inside of a value and 3rd your using "then do" instead of using then, and also 4th you have to use a local script inside of the player to use "LocalPlayer" so you'll have to set up remoteevent to change the value, so it'll have to be like this:
local player = game.Players.LocalPlayer local leaderstats = player:FindFirstChild("leaderstats") local kill = leaderstats.Kills if script.Parent.Health == 0 then kill.Value = kill.Value + 1 end end