function Debounce(debounceVariable, func) --1 second cooldown
if not debounceVariable then
debounceVariable = true
func()
wait(1)
debounceVariable = false
end
end
local DirectionCheckerHit = nil;
DirectionChecker.Touched:connect(function(hit)
Debounce(DirectionCheckerDebounce, function(
if DirectionCheckerHit == nil then
print("DirectionCheckerHit is nil")
end
)end)
end)
I get an error from the if/then line descending from the Touched connection. It says, "expected identifier, got 'if'". I'm trying to write a function as one of the arguments of my Debounce function. Is it even possible to write a function as an argument?

5 comments
Pretty sure you can if the function returns a value
Pretty sure you can if the function returns a value
they don't have to, lol.
i found it my brothers, i had to put a close parentheses in a certain spot
function(on line 13 is missing a closing bracket