note: im new to posting so i apologize for mistakes
You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
whenever i kill the zombies i should get the kills and points
What is the issue? Include screenshots / videos if possible!
i cant give kills and points due to a error i cant figure out
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i couldnt find solutions to my error
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
game.Players.PlayerAdded:Connect(function(player)
if script.Parent.Zombie.Health >= 0 then
local leaderstats=game.Players:FindFirstChild("leaderstats")
leaderstats.Kills.Value += 1
leaderstats.Points.Value += 2
end
--this is server script btw
end)```
You have to actually make a leaderstats folder yourself. If you have and it’s being created by another routine, use :WaitForChild(“leaderstats”) instead of :FindFirstChild(“leaderstats”).
Here is a tutorial on how to create your own leaderstats!
ok so the thing is whenever i play tested it gave me the points and kills, however whenever i killed the zombies it didnt give me the points and kills.
game.Players.PlayerAdded:Connect(function(player)
if script.Parent.Zombie.Health >= 0 then
local leaderstats = player:WaitForChild("leaderstats")
leaderstats.Kills.Value += 1
leaderstats.Points.Value += 2
end
end)
game.Players.PlayerAdded:Connect(function(player)
if script.Parent.Zombie.Health >= 0 then
local leaderstats = player:WaitForChild("leaderstats")
leaderstats:WaitForChild("Kills").Value += 1
leaderstats:WaitForChild("Points").Value += 2
end
end)
I just noticed that in the error message you showed in the original post, you’re trying to find the leaderstats within “NoobClone”. I assume this is a mob you’re killing which will award you the points?