How to increase leaderstat?
I;m trying to code out a script that increase the leaderstat "headsize" whenever the u key is pressed and this is what I have so far:
03 | function KeyPress(input, gameProcessed) |
05 | if input.KeyCode = = Enum.KeyCode.U then |
11 | game:GetService( "UserInputService" ).InputBegan:Connect(KeyPress) |
14 | game.Players.PlayerAdded:Connect( function (player) |
17 | local leaderstats = Instance.new( "Folder" ) |
18 | leaderstats.Name = "leaderstats" |
19 | leaderstats.Parent = player |
21 | local headsize = Instance.new( "IntValue" ) |
22 | headsize.Name = "headsize" |
24 | headsize.Parent = leaderstats |
The start works as it starts out with 0, but when I press the U key, nothing happens. I'm sure it's something simple that I'm just blind to, but if you can help me out thanks!