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

Debounce not working as intended?

Asked by
Aozwel 71
4 years ago

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

Log in to vote
1
Answered by
sheepposu 561 Moderation Voter
4 years ago

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)
0
Thanks buster! Aozwel 71 — 4y
0
np sheepposu 561 — 4y
Ad

Answer this question