I've been at this for a while, but I don't seem to get it. It doesn't add +1 to the SP value, am I doing something wrong?
local text = script.Parent.Parent.Parent.Frame2.TextLabel local PointsService = game:GetService("PointsService") local button = script.Parent button.MouseButton1Click:connect(function(Player) text.Text = "+1 SP" script.Parent.Sound:Play() button.Position = UDim2.new(math.random(4), math.random(4), math.random(4)) Player.leaderstats.SP.Value = Player.leaderstats.SP.Value + 1 end)
Everytime I click the button, the message,
"16:25:22.013 - Players.meteorcrasher118.PlayerGui.ScreenGui.Frame.TextButton.Script:9: attempt to index local 'Player' (a nil value)"
keeps appearing.
GuiButton.MouseButton1Click
does not have a Player
argument. Go up from script
until you hit the player, for a solution which works in both LocalScripts and regular Scripts