So I was writing a script, so far I have a few values in my PlayerScripts like gun1, gun2, gun3 ect so I can reach them in my shop script. Anyways, I'm having a few problems here is my script:
local player = game:GetService("Players").LocalPlayer
local gold = player.leaderstats.Coins
local sp = game.Players.LocalPlayer.PlayerScripts
function buy()
if gold.Value >= 0 then
gold.Value = gold.Value - 0
sp.gun1 = true
end
end
script.Parent.MouseButton1Down:connect(buy)

6 comments
you never said what problems it has
My problem is it says. 'localplayer is a nil value and my script doesn't work at all. It's a local script in starter gui
...is it in a localscript?
yes, It's a local script in startergui lol
There's no way
So how do you suppose I make a gui shop for my game? I'll pay.