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

0

Pretty sure you can if the function returns a value

0

Pretty sure you can if the function returns a value

0

they don't have to, lol.

1

i found it my brothers, i had to put a close parentheses in a certain spot

0

function( on line 13 is missing a closing bracket