Only prints once if step on it twice

local RS = game:GetService("ReplicatedStorage")
local Tool = RS:FindFirstChild("regularSeeds")
local Debounce = true

script.Parent.Touched:Connect(function(Hit)
    local Player = game:GetService("Players"):GetPlayerFromCharacter(Hit.Parent)
    if Player and Debounce == true then
        Debounce = false
        if Player.leaderstats.coins.Value < 10 then
            print(Player.Name .. " doesn't have enough coins")
        else
            Player.leaderstats.coins.Value = Player.leaderstats.coins.Value - 10
            Tool:Clone().Parent = Player:WaitForChild("Backpack")
            wait(1)
            Debounce = true
        end
    end
end)

if the player doesn’t have enough coins if they step on the pad again it doesn’t print again
if the player steps on it
with out enough coins
it prints it

It’s cause you encased your Debounce = true line in the else statement, hence why it’s not continuing after touching it again

local RS = game:GetService("ReplicatedStorage")
local Tool = RS:FindFirstChild("regularSeeds")
local Debounce = true

script.Parent.Touched:Connect(function(Hit)
    local Player = game:GetService("Players"):GetPlayerFromCharacter(Hit.Parent)
    if Player and Debounce == true then
        Debounce = false
        if Player.leaderstats.coins.Value < 10 then
            print(Player.Name .. " doesn't have enough coins")
        else
            Player.leaderstats.coins.Value = Player.leaderstats.coins.Value - 10
            Tool:Clone().Parent = Player:WaitForChild("Backpack")
        end

        wait(1)
        Debounce = true
    end
end)
1 Like