BindableEvent help

so I’ve been working on a fighting game, and I’ve been trying to add counters, but it doesn’t seem to really work as I intend. So basically the damage module sends a BindableEvent event over to the person’s ability script (its a server script) and it’s meant to return the Countered variable, which is true or false. However, it returns nil. Since these BindableEvents are kind of new to me, I have no idea what I am doing wrong.

DamageModule:

 		local z= game.ServerStorage.ImportantEvents.CheckForCounter:Fire(Enemy)
		print(z)
		if z == true then
			Countered = true
		else
			Countered = false
		end

Ability Script:

game.ServerStorage.ImportantEvents.CheckForCounter.Event:Connect(function(victim)
	if victim == Player.Character then
		return Countering
	end
end)

If you’re expecting a return value, think you might need to use BindableFunction instead of a BindableEvent

Also some advice, you can set Countered to be equal to z instead of using an if statement in this case

Thanks for telling me about BindableFunctions!

and the advice, I had it like that originally but it didn’t work at all so I kept trying to see any change (there was none)

1 Like