Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why will it only give me 1.5x clicks when I click the button to buy it?

Asked by 1 year ago

Can someone please tell me why I only get 1.5x clicks when I click the button to buy 1.5x clicks, but not when I click the button to give me clicks? Thanks!

local button = script.Parent
local player = button:FindFirstAncestorOfClass("Player")
repeat
    player = button:FindFirstAncestorOfClass("Player")
    task.wait()
until player ~= nil

local debounce = true
button.MouseButton1Click:Connect(function()
    if debounce then
        debounce = false

        local leaderstats = player:WaitForChild("leaderstats")
        local Clicks = leaderstats:WaitForChild("Clicks")
        Clicks.Value += 1

        task.delay(0.5, function()
            debounce = true
        end)
    end
end)

local debounce2 = true
player.PlayerGui.Shop.ShopFrame.X1dot5.MouseButton1Click:Connect(function()
    local leaderstats = player:WaitForChild("leaderstats")
    local Clicks = leaderstats:WaitForChild("Clicks")
    local Coins = leaderstats:WaitForChild("Coins")

    if (Coins.Value >= 50) and debounce2 then
        debounce2 = false
        Clicks.Value += 1.5

        task.delay(0.5, function()
            debounce2 = true
        end)
    end
end)

Answer this question