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

Debounce not working as intended?

Hey there,new scripter here

I'm not sure if i have miss placed something but the debounce doens't seem to be working, Anytime i try and move it i get End expected errors?

local host = script.Parent
local myThread = coroutine.running()
debounce=true

function continueColorChange()
    coroutine.resume(myThread)
end

if debounce == true then
        debounce = false

host.Touched:Connect(continueColorChange)
script.Parent.Touched:Connect(function(hit)
	wait(.5)
	host:Destroy()
game.ReplicatedStorage.dialogTrigger:FireAllClients()
wait(10)
		debounce = true
end)

1 answer

✓ Accepted answer

Your script was missing an end block

local host = script.Parent
local myThread = coroutine.running()
debounce=true

function continueColorChange()
    coroutine.resume(myThread)
end

if debounce == true then
        debounce = false
end --Put end block here

host.Touched:Connect(continueColorChange)
script.Parent.Touched:Connect(function(hit)
    wait(.5)
    host:Destroy()
game.ReplicatedStorage.dialogTrigger:FireAllClients()
wait(10)
        debounce = true
end)

2 comments

0

Thanks buster!

0

np

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