I made a shop GUI completely with scripts, GUIs, and all the other stuff you need to make a Shop GUI. There's a problem. I just started learning how to use debounces from blackoragnge3343 (thanks btw) and it's still not "debouncing" properly. When I choose for example, Adurite Knife. It does give me one knife. But the next knife I choose (American Knife) gives me 2 instead of 1. Next thing I chose was the Canadian Knife, and it gives me 3. When I try the ban hammer, it doesn't give me anything at all. Can anyone help where I should put my debounces on again? or is it a script problem?
aduritecost = 500
americancost = 1000
--banhammer = admin
canadiancost = 1000
cupcakecost = 100
--devknife = developers
diecost = 100
dogecost = 250
galaxycost = 800
goldencost = 5000
koolcost = 400
mediccost = 500
missingtexturecost = 1800
moneycost = 10000
nightvisioncost = 500
noobcost = 50
robloxcost = 500
rainbowcost = 2500
unicorncost = 10000
tediorecost = 7500
ukcost = 1000
yeetcost = 15000
local player = game.Players.LocalPlayer
local shopgui = player.PlayerGui:WaitForChild("ShopGUI")
local shopmaster = shopgui:WaitForChild("ShopMaster")
local pages = shopmaster:WaitForChild("Pages")
local knives = pages:WaitForChild("Knives")
local description = knives:WaitForChild("Description")
local purchasesound = knives:WaitForChild("PurchaseNoise")
local replicatedstorage = game:GetService("ReplicatedStorage")
local knifestorage = replicatedstorage:WaitForChild("KnifeStorage")
local knifename = description:WaitForChild("ItemName")
local buy = description:WaitForChild("BuyButton")
local debounce = false
function onKnifePurchased()
if not debounce then
debounce = true
buy.MouseButton1Down:connect(function()
if knifename.Text == ("Adurite Knife") then
if player then
local leaderstats = player:findFirstChild("leaderstats")
local coins = leaderstats:findFirstChild("Coins")
if coins.Value >= aduritecost then
coins.Value = coins.Value - aduritecost
knifestorage:findFirstChild("Adurite Knife"):clone().Parent = player.Backpack
wait()
debounce = false
end
end
elseif knifename.Text == ("American Knife") then
if player then
local leaderstats = player:findFirstChild("leaderstats")
local coins = leaderstats:findFirstChild("Coins")
if coins.Value >= americancost then
coins.Value = coins.Value - americancost
knifestorage:WaitForChild("American Knife"):clone().Parent = player.Backpack
wait()
debounce = false
end
end
elseif knifename.Text == ("Ban Hammer") then
if not debounce then
debounce = true
if player.Name == "randomnamelmao" or "Jxemes" then
knifestorage:WaitForChild("Ban Hammer"):clone().Parent = player.Backpack
wait()
debounce = false
end
end
elseif knifename.Text == ("Canadian Knife") then
if player then
local leaderstats = player:findFirstChild("leaderstats")
local coins = leaderstats:findFirstChild("Coins")
if coins.Value >= canadiancost then
coins.Value = coins.Value - canadiancost
knifestorage:WaitForChild("Canadian Knife"):clone().Parent = player.Backpack
wait()
debounce = false
end
end
end
end)
end
end
knifename.Changed:connect(onKnifePurchased)
buy.Changed:connect(onKnifePurchased)

2 comments
I did your 1st step and it already works! You, I have to say, are one of the best scripting helpers. Not only to give the answer, you also provide steps of how to do it, tips, and it's organized! Really awesome, and thanks again!
Thanks.