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

My debounce doesnt work on my colour changing tile script? Help

Asked by 4 years ago

I am new to scripting and i tried to make a simple colour changing tile script with a debounce but it doesnt work.

local part = script.Parent
local debounce = false

script.Parent.Touched:Connect(function(hit)
    if hit.Parent then
        if not debounce then
            debounce = true
            part.Material = "Neon"
            part.BrickColor = BrickColor.Random()
            debounce =  false
        end
    end
end)

I looked at the wiki to try learn debounce but i found it a bit confusing. Any help would do explaining debounce and how to fix my script

0
The debounce isn’t performing an actual preventive instruction. Add a wait(timeNumber) before calling debounce = false Ziffixture 6913 — 4y
0
Thanks Feahren! It worked Spo_tted 15 — 4y

Answer this question