Trying to make a script that runs a different function once it's finished, but I keep getting "attempted to call a nil value"

function a(func)
	-- do stuff
	func()
end

a(function()
	print("b")
end)

What am I doing wrong? I've been scripting for a while now, but I just can't seem to get this to work.

Edit: This does work when it's called from the same function, but it doesn't work when I try to call it from a remote event/function

2 comments

0

are you sure this doesn't work?

0

It works when I try to run it from the same script, but if I, say, try to run it from a remote function, it doesn't work