I've made a leaderboard with the money and i've tried to make it a keydown event. And it didnt work even if i've had enough.
Leaderboard Script
game.Players.PlayerAdded:connect(function(p)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
stats.Parent = p
local money = Instance.new("IntValue")
money.Name = "CryptBux"
money.Value = 500
money.Parent = stats
end)
GUI Item Purchasing Local Script
repeat wait()
Player = Game.Players.LocalPlayer.
Button = script.Parent
Item = game.ReplicatedStorage:FindFirstChild("Benelli M3")
Cost = 500
Money = Player.leaderstats.CryptBux
until
Button.KeyDown(t):connect(function(purchase)
if Money.Value > (Cost - 1) then
Money.Value = Money.Value -
local a = Item:Clone()
a.Parent = Player.Backpack
local b = Item:Clone()
b.Parent = Player.StarterGear
end
end)

1 comment
I can see an error on line 2 in the second script. Notice the extra dot.