Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Anyone knows how to add this script a debounce?

local Spirit = script.Parent

 Spirit.Touched:connect(function(entity)

     if entity.Parent.Name == "WaterEssence" and game.Players:FindFirstChild(entity.Parent.Parent.Name) then

        local Man =  entity.Parent.Parent.Parent

        local RealMan = game.Players:FindFirstChild(entity.Parent.Parent.Name)

        local Bro = RealMan:FindFirstChild("leaderstats")

        local EXP = Bro:FindFirstChild("EXP")

        EXP.Value = EXP.Value + 10

        print(EXP.Value)

        wait(20)               

     end

 end)

Help please. SuVee, Aspiring Dev

1 comment

0

Connect not connect

1 answer

Add a DeBounce variable.

local debounce = false -- Set to false first 

We will then in your first if statement say:

-- Add this to your first if statement
if not debounce then
    debounce = true
    -- wait() If you want to wait for it to run again.
    debounce = false 
end

1 comment

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.