RemoteEvent not firing from my tool

What do you want to achieve? I’m trying to fire a remote event to my server script in my tool by checking whether the RayCast has hit another player object. The local script fires the remote event, however, the server script doesn’t receive the fired event…

Anyway to fix this?

I’ve also used the “RaycastHitboxV4” Module script by @TeamSwordphin for the hitboxes.
The RemoteEvent has already been defined

Explorer Screenshot

Issue

Local Script

--When we hit someone
local function onRayResult(hit, humanoid)
	if humanoidDebounce[humanoid] == true then
		return "hit object is on cooldown"
	end
	humanoidDebounce[humanoid] = true
	local distance = (clientRoot.Position - humanoid.Parent.PrimaryPart.Position).Magnitude
	meleeEvent:FireServer(humanoid, hit, distance)
	wait(swingTime)
	humanoidDebounce[humanoid] = false
end


-- Connections
hitbox.OnHit:Connect(onRayResult)
tool.Equipped:Connect(onEquip)
tool.Unequipped:Connect(onUnequip)
tool.Activated:Connect(onClick)

Server Script

-- Handle Damage Dealing and Anti Exploit
event.OnServerEvent:Connect(function(plr, hitHum, hit, clientDist)
	print("Fired server")
	local serverDist = (plr.Character.PrimaryPart.Position - hitHum.Parent.PrimaryPart.Position).Magnitude
	if clientDist - serverDist > bladeLength + 5 then
		plr:Kick("Your blade reach is larger than usual. You either have extremely high ping, or are exploiting.")
	end
	local critChance = math.random(1, 5)
	if critChance == 1 then
		-- If crit
		hitHum:TakeDamage(critDamage)
	else
		-- If not crit
		hitHum:TakeDamage(damage)
	end
end)

Thanks!

If the server isn’t receiving anything, you either mentioned the wrong remote event, or the event is not being fired in the first place. Try adding print statements before and after calling the FireServer() event in the local script, and see if anything is printed in the output.

1 Like

The remote event is firing from the client yes, but the server just doesn’t receive it

Idk how, but the script just fixed itself, maybe it was a glitch from Roblox studio…

Sorry for wasting your time @BabyNinjaTime

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.