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)
local player = game:GetService("Players").LocalPlayer local gold = player.leaderstats.Coins local sp = player.PlayerScripts function buy() if gold.Value >= 0 then gold.Value = gold.Value - 0 sp.gun1 = true end end script.Parent.MouseButton1Down:connect(buy)
Try this, it should work let me know if it doesn't.