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

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

Asked by 5 years ago
Edited 5 years ago
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

Log in to vote
0
Answered by
valchip 789 Moderation Voter
5 years ago
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)
0
why did you use a variable and not just a number DeceptiveCaster 3761 — 5y
0
that's completely unnecessary DeceptiveCaster 3761 — 5y
0
yuuuuuppppp Marrise101 -5 — 5y
0
yuupp ikr Marrise101 -5 — 5y
View all comments (2 more)
0
@MCAndRobloxUnited because I can. Ik it is useless but I want him to get the point. valchip 789 — 5y
0
^^^ the8bitdude11 358 — 5y
Ad

Answer this question