hello, I made a script that's supposed to change the players hat depending on how many kills they have, but it doesn't work and in the output it says Workspace.ht518.Script:1: attempt to index nil with 'leaderstats'
if game.Players.LocalPlayer.leaderstats.Kills.Value == 10
then
script.Parent.hat:Destroy()
game.ServerStorage.hat1:Clone()
game.ServerStorage.hat1.Parent = script.Parent
end
can anybody help me with this, it is a (Server) Script in StarterCharacterScripts

3 comments
I can see that the script is in StarterCharacterScripts, however, is it a LocalScript or a (Server) Script?
It's a Server Script
If it's a server script you can't use LocalPlayer