Could I get some help with my script? I made a surface Gui shop using Coins as money but when I click the button it doesn't give me my item or spend the Coins for it. here's the script
repeat wait()
Player = game.Players.LocalPlayer
Button = script.Parent
Item = game.ReplicatedStorage:FindFirstChild("BloxyCola")
Cost = 25
Coin = Player.leaderstats.Coins
until
Button.MouseButton1Down:connect(function(purchase)
if Coin.Value > (Cost - 1) then
Coin.Value = Coin.Value - Cost
local a = Item:Clone()
a.Parent = Player.Backpack
local b = Item:Clone()
b.Parent = Player.StarterGear
end
end)
Oh and here's where the script is. (Sign.SurfaceGui.TextButton.LocalScript)

2 comments
Thanks, it works now.
No problem