I dont know how to do the script this is my leaderboard (it works)
rint("Cash Leaderboard Loaded")
function onPlayerEntered(newPlayer) local stats = Instance.new("IntValue") stats.Name = "leaderstats" local cash = Instance.new("IntValue") cash.Name = "Cash" cash.Value = 50 cash.Parent = stats stats.Parent = newPlayer end game.Players.ChildAdded:connect(onPlayerEntered)
i tried puting this code in to the zombie
1 if script.Parent.Health == 0 then 2 value = value +1 just dont work
plz any1 help if you do thank you
Heres a script For The NPC:
script.Parent.Humanoid.Died:Connect(function() local Players = game:GetService("Players") local Player = Players.LocalPlayer -- LocalPlayer is not A Service local leaderstats = LocalPlayer.leaderstats leaderstats.Cash.Value = leaderstats.Cash.Value + 1 end)
Also fix for leaderstats:
Excepted, leaderstats Parent:
function onPlayerEntered(newPlayer) local leaderstats = Instance.new("IntValue") leaderstats.Name = "leaderstats" leaderstats.Parent = newPlayer local cash = Instance.new("IntValue") cash.Name = "Cash" cash.Value = 50 cash.Parent = stats game.Players.PlayerAdded:connect(onPlayerEntered)
Well, first you need to find the player. Try doing something like this.
local player = () -- you need to find the player with the weapon while true do if script.Parent.Humanoid.Health == 0 player.leaderstats.Cash.Value = +1 end
And then do everything else yourself cause I can't since I don't have the weapon. You need to do some script in the weapon to check who killed the npc.