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

The Humanoid keeps waving and it doesn't stop. How do i create a debounce?

local hum = script.Parent.Parent.ShopOwner.Humanoid


local anim = hum:LoadAnimation(script.Parent.Parent.ShopOwner.WaveAnim)

function onTouch(part) 
	local humanoid = part.Parent:FindFirstChild("Humanoid") 
	
		anim:Play()
	end 


script.Parent.Touched:connect(onTouch)

1 answer

local hum = script.Parent.Parent.ShopOwner.Humanoid

local db = true

local amountOFdbSECS = 3 --change it to the amount you want


local anim = hum:LoadAnimation(script.Parent.Parent.ShopOwner.WaveAnim)

function onTouch(part) 
if db == true then
db = false
    local humanoid = part.Parent:FindFirstChild("Humanoid") 

        anim:Play()
    end 
wait(amountOFdbSECS)
db = true
end

script.Parent.Touched:Connect(onTouch)

6 comments

0

why did you use a variable and not just a number

0

that's completely unnecessary

0

yuuuuuppppp

0

yuupp ikr

0

@MCAndRobloxUnited because I can. Ik it is useless but I want him to get the point.

0

^^^

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