RaycastHitboxV4 not functioning properly

My problem is that whenever I try to create a RaycastHitbox the debug lines don’t show and the hitbox can’t be recognized.

I get random errors as well such as:

ServerStorage.Server.Attack.Melee:32: attempt to call missing method 'HitStop' of table

for _: number, point: Point in ipairs(ActiveHitboxes[i].HitboxRaycastPoints) do -- In the hitboxcaster

It mostly says HitStop and HitStart are missing methods.

It worked a while ago but I don’t know what I did to make it not work.

I checked through my past history but even in those past sessions when it did work, its not working anymore.

I don’t know what magical thing happened for this to change.

Code
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local signals = ReplicatedStorage.Signals
local unreliables = signals.Unreliables

local raycastHitbox = require(script.RaycastHitboxV4)
local infoSignaler = require(script.Parent.InfoSignaler)

local playerHitboxes = {}

local function reset(connections)
	for _,comp in ipairs(connections) do
		comp:Disconnect()
	end
	table.clear(connections)
	return connections
end


local Melee = {}

Melee.Start = function(plr,tool,info,playerParams,plrConnections)
	local char = plr.Character or plr.CharacterAdded:Wait()
	local root = char.HumanoidRootPart
	local c1,c2
	playerHitboxes[plr] = raycastHitbox.new(tool.Hitbox)
	playerHitboxes[plr].RaycastParams = playerParams
	
	c1 = tool.Activated:Connect(function()
			playerHitboxes[plr]:HitStart()
		task.wait(info.Cooldown)
			playerHitboxes[plr]:HitStop()
	end)
	
	c2 = playerHitboxes[plr].OnHit:Connect(function(hit,humanoid)
		local targetChar = hit.Parent
		local targetRoot = targetChar.HumanoidRootPart

		for _,player in Players:GetPlayers() do
			local playerChar = player.Character or player.CharacterAdded:Wait()
			local playerRoot = playerChar.HumanoidRootPart
			if (playerRoot.Position - tool.Hitbox.Position).Magnitude < 5e2 then
				local returnedInfo = infoSignaler[tool.Name](tool)
				unreliables.ToClient:FireClient(player,tool.Name.."FX",returnedInfo)
			end
		end

		targetRoot.AssemblyLinearVelocity = ((targetRoot.Position - root.Position) * 25) + Vector3.new(0,50,0)
		humanoid:TakeDamage(info.Damage)
	end)
	
	table.insert(plrConnections,c1)
	table.insert(plrConnections,c2)
	return plrConnections
end

Melee.End = function(plr,plrConnections)
	if playerHitboxes[plr] then playerHitboxes[plr]:Destroy() table.clear(playerHitboxes[plr]) playerHitboxes[plr] = nil end
	local resetConnections = reset(plrConnections)
	return resetConnections
end

return Melee

I have another main module called attack above this one but it just starts and ends these when equipping and unequipping tools.

I also tried moving the playerHitboxes table to the parent attack module but it did the same thing.

I found the solution, the weld constraint connecting the primary part of the tool and the hitbox was randomly unenabled.

1 Like

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