I'm making a shooter, and I'm making a shop. The problem is, whenever I click on the shop item I'm trying to get, I don't get anything. Here's the script for the button:
repeat wait()
Player = game.Players.LocalPlayer
Button = script.Parent
Item = game.ReplicatedStorage:FindFIrstChild("GravityCoil")
Cost = 50
Money = Player.leaderstats.Money
until
Button.MouseButton1Down:connect(function(purchase)
if Money.Value > (Cost - 1) then
Money.Value = Money.Value - Cost
local a = Item:Clone()
a.Parent = Player.Backpack
local b = Item:Clone()
b.Parent = Player.StarterGear
end
end)
This is the script for the leaderboard I was using (I gave myself 50 money)
game.Players.PlayerAdded:connect(function(p)
local stats = Instance.new("IntValue", p)
stats.Name = ("leaderstats")
local money = Instance.new("IntValue", stats)
money.Name = "Money"
money.Value = 50
end)
Thanks in advance!

3 comments
Yep. thx
Thumbs up and accept the answer if this helped!
I accepted :c Right after I typed the question I looked back into the script and found my error :P. Thanks for answering tho :)