BindableEvent.Event not firing

  1. What do you want to achieve? Keep it simple and clear!
    I want to send a simple event through a bindable event that contains two arguments, one for part and another for humanoid. Fire and Event are both present in module scripts running from the server side.

  2. What is the issue? Include screenshots / videos if possible!
    The .Event event is not firing, thus breaking the scripts.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried researching Signal classes such as quenty’s but I feel they are essentially bindable events in their core.

For more info, I’m making a hitbox system for my game. When the hitbox detects a part whose parent has a humanoid, and is not part of debounce table, it sends an event through the aforementioned bindable event. But when I try to receive the event through the .Event event, It does not register.

Hitbox Module(module script)

local Hitbox = {}
Hitbox.__index = Hitbox

local function CreateVolumetricHitbox(size:Vector3, cframe:CFrame | Instance?, offset:CFrame):BasePart?
	local hitbox = Instance.new("Part")
	hitbox.Size = size
	hitbox.CFrame = cframe * offset
	hitbox.Transparency = 0
	hitbox.CanCollide = false
	hitbox.Anchored = true
	hitbox.Parent = workspace
	return hitbox
end

function Hitbox.Create(hitboxType:number | string, params:RaycastParams?)
	local self = {}

	if typeof(hitboxType) == "number" then
		if hitboxType == 1 then
			warn("Raycast based hitbox detection isn't supported yet.")
			self.HitboxType = "Raycast"
		elseif hitboxType == 2 then
			self.HitboxType = "Spatial"
		end
	elseif typeof(hitboxType) == "string" then
		if hitboxType == "Raycast" then
			warn("Raycast based hitbox detection isn't supported yet.")
			self.HitboxType = "Raycast"
		elseif hitboxType == "Spatial" then
			self.HitboxType = "Spatial"
		end
	end

	self.CFrame = CFrame.new()
	self.Offset = CFrame.new()
	self.Size = Vector3.new(1, 1, 1)
	self.OverLapParams = OverlapParams.new()
	self.Active = false

	self.Touched = Instance.new("BindableEvent")

	return setmetatable(self, Hitbox)
end

function Hitbox:Detect(duration:number)
	if self.Active then return; end

	local detectedParts = {}
	local hitParts = {}
	local debounce = {}

	self.Active = true
	if self.HitboxType == "Spatial" then
		local hitbox = CreateVolumetricHitbox(self.Size, self.CFrame, self.Offset)
		local connection; connection = game:GetService("RunService").Heartbeat:Connect(function()
			hitbox.CFrame = self.CFrame
			detectedParts = workspace:GetPartsInPart(hitbox, self.OverLapParams)

			for i, v:Instance in detectedParts do
				if not table.find(hitParts, v) and v.Parent and v.Parent:FindFirstChildOfClass("Humanoid") then
					table.insert(hitParts, v)
				end
			end

			for i, v in hitParts do
				if not table.find(debounce, v.Parent.Humanoid) then
					self.Touched:Fire(v, v.Parent.Humanoid)
					print("fired")
					table.insert(debounce, v.Parent.Humanoid)
					task.spawn(function()
						task.wait(1)
						table.remove(debounce, table.find(debounce, v.Parent.Humanoid, 1))
					end)
				end
			end
		end)
		task.wait(duration)
		self.Active = false
		connection:Disconnect()
		connection = nil
		hitbox:Destroy()
	end
end

return Hitbox

Object Module(module script, but what I am about to show is only a part of it as this part is the only one which deals with the hitbox stuff.)

["Experimental"] = {
		activate = function(self)
			local overlapParams = OverlapParams.new()
			overlapParams.FilterType = Enum.RaycastFilterType.Exclude
			overlapParams.FilterDescendantsInstances = {self.ObjectContainer}

			local HitboxModule = require(script.Parent.Hitbox)
			local hitbox = HitboxModule.Create(2)
			hitbox.Size = self.Object.Size
			hitbox.OverLapParams = overlapParams

			game:GetService("RunService").Heartbeat:Connect(function()
				hitbox.CFrame = self.Object.CFrame
			end)

			hitbox.CFrame = self.Object.CFrame
			local swinganim = self.ObjectContainer.Parent:FindFirstChild("Humanoid"):FindFirstChild('Animator'):LoadAnimation(clubswing)
			swinganim:Play()
			hitbox:Detect(1)

			hitbox.Touched.Event:Connect(function(hit, hum)
				print("e")
				Damage(self.ObjectContainer.Parent, 45, hum, false)
			end)
		end;
		["COOLDOWN"] = 0.3;
	};

in this script the activate function is a function that runs when the tool is activated.

Try removing the Event and hum in this line:

hitbox.Touched.Event:Connect(function(hit, hum)

Change to:

hitbox.Touched:Connect(function(hit)

You can get the hum from the hit by checking if the hit.Parent has a humanoid:

hitbox.Touched:Connect(function(hit)
	if hit and hit.Parent:FindFirstChild("Humanoid") then -- it is a character
		hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 10 -- or whatever
	end
end)

It doesn’t work, instead it gives this error

Connect is not a valid member of BindableEvent "Event"

Oh, you can’t use a Touch on a BindableEvent.

Change to:

hitbox.Event:Connect(function()
	-- stuff
end)

The hitbox has a item called touched

function Hitbox.Create(hitboxType:number | string, params:RaycastParams?)
local self = {}

if typeof(hitboxType) == “number” then
if hitboxType == 1 then
warn(“Raycast based hitbox detection isn’t supported yet.”)
self.HitboxType = “Raycast”
elseif hitboxType == 2 then
self.HitboxType = “Spatial”
end
elseif typeof(hitboxType) == “string” then
if hitboxType == “Raycast” then
warn(“Raycast based hitbox detection isn’t supported yet.”)
self.HitboxType = “Raycast”
elseif hitboxType == “Spatial” then
self.HitboxType = “Spatial”
end
end

self.CFrame = CFrame.new()
self.Offset = CFrame.new()
self.Size = Vector3.new(1, 1, 1)
self.OverLapParams = OverlapParams.new()
self.Active = false

self.Touched = Instance.new(“BindableEvent”)

return setmetatable(self, Hitbox)
end

which is a variable for the bindable event.

Now if this is a Roblox bug we’ll have nothing else to do other than report the bug.

I have no idea what any of that means, but this is the classic use of a BindableEvent (if it helps):

-- SENDER SCRIPT


local event = YourBindableEventOnTheServer

-- something happened, so send info

event:Fire(info1, info2, info3, etc)





-- RECEIVER SCRIPT

local event = YourBindableEventOnTheServer

event.Event:Connect(function(info1, info2, info3, etc)
	
	--  do stuff
	
end)

I am doing essentially the same, just across some modules.