Unable to cast RaycastParams to OverlapParams with MuchachoHitbox module

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I wanted to achieve my explosion script to work properly. However, I get notified saying “Unable to cast RaycastParams to OverlapParams.”

  1. What is the issue? Include screenshots / videos if possible!

I have stated the issue on my first question. I’ll provide some pictures.


  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

I tried other solutions by removing the raycastparams. However, it does not work as I intended. I wanted to blacklist certain characters or models for the script to function as intended.

local function GetRaycastParams() -- This is how I got my raycastparams. This usually works on other raycast modules.
	local Table = {Player.Character, Tool, Projectiles}
	local Params = RaycastParams.new()
	Params.FilterType = Enum.RaycastFilterType.Blacklist
	
	for _, Obj: Instance in ipairs(game.Workspace:GetDescendants()) do
		if Obj:IsA("Accessory") then
			table.insert(Table, Obj)
		end
	end
	
	Params.FilterDescendantsInstances = Table
	
	return Params
end
function Attack.Explode(PartToAttach: BasePart, Size: number, RaycastParameters: RaycastParams)
	local MetaTable = {}
	local newHitbox = PartHitbox.CreateHitbox()
	newHitbox.Size = Size
	newHitbox.CFrame = PartToAttach
	newHitbox.Shape = Enum.PartType.Ball
	newHitbox.DetectionMode = "HitOnce"
	newHitbox.OverlapParams = RaycastParameters
	newHitbox.Visualizer = Information.DebugMode
	
	MetaTable.Hitbox = newHitbox
	MetaTable.HitboxAttachedPart = PartToAttach
	
	newHitbox:Start()
	
	setmetatable(MetaTable, Attack)
	return MetaTable
end```

Is there any reason you are not using OverlapParams?

EDIT: Just realized you said OverlapParams instead of RaycastParams. I have not heard of that before. I’ll try that out.

That solved the issue, thanks!

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