I have such a problem in this script when I click does not give me these points in leaderstats is that there is such an error: attempt to index local 'player' (a nil value) line 3 and here is the script:
script.Parent.MouseClick:Connect(function(Player) Player = game.Players.LocalPlayer Player.leaderstats.Strength.Value = Player.leaderstats.Strength.Value + 1
please help
Remove line 2. The player
who clicks the part containing the ClickDetector
is passed to the Player
parameter, so you do not need to redefine it.
Also, just in case you didn't know, you also need to end your function
and close out the Connect
method.
Do this by writing end)
on a new line following the completion of your function.
script.Parent.MouseClick:Connect(function(Player) Player.leaderstats.Strength.Value = Player.leaderstats.Strength.Value + 1 end)
If you have additional errors, let us know and edit your question to include your updated and complete script.