What is the best way to create a precise hitbox for a fast moving object?

What I am trying to achieve is to make the player dash forward and hit the first player the hitbox touches to. Already done the dash and the hitbox weld but I don’t know how I should make the hitbox work. Whats the best method here? Player dash is too fast so I want a method that will give me the best precision. Any ideas?

Edit: Ended up using Blockcast and the skill turned out exactly how I wanted it to be.

you could use blockcast or just raycast WorldRoot | Documentation - Roblox Creator Hub

3 Likes

Thanks for the suggestion. I am currently trying it out but I have one problem. I want to cast the ray to where player is looking at in a straight line. Current code is:

		local params = RaycastParams.new()
		params.FilterDescendantsInstances = {workspace.Model}

		local vHitbox = RS.Uhkia.UhkiaHitboxes.SakusaHitboxes.sakusaVHitbox:Clone()
		local direction = humRP.CFrame.LookVector * 50
		local result = workspace:Blockcast(humRP.Position, vHitbox.Size, direction, params)

I am getting “Unable to cast Vector3 to CoordinateFrame”. What should I do?

1 Like

where is this script located and can you show more code please
also your params arent blacklist set it to that
and you dont need to clone the hitbox just reference it
also the error is because it doesnt know where the humanoidrootpart is

	sakusaRemote.OnServerEvent:Connect(function(player, action, variable3)

		--PLAYER VARIABLES--
		local character = player.Character
		local humRP = character:FindFirstChild("HumanoidRootPart")
		local humanoid = character:FindFirstChild("Humanoid")
		local mouse = player:GetMouse()
 --THERE ARE MORE SCRIPT BETWEEN THESE BUT THEY ARENT RELATED SO I AM ONLY SHOWING THE ONSERVEREVENT AND THE ACTION

	elseif action == "V" then
		if not equipped.Value then return end
		if holding.Value ~= "None" then return end
		if vDebounce then return end
		if disabled.Value == true then return end
		if using.Value == true then return end

		local params = RaycastParams.new()
		params.FilterDescendantsInstances = {workspace.Model}

		local vHitbox = RS.Uhkia.UhkiaHitboxes.SakusaHitboxes.sakusaVHitbox:Clone()
		local direction = humRP.CFrame.LookVector * 50
		local result = workspace:Blockcast(humRP.Position, vHitbox.Size, direction, params)

I am pretty sure that humanoidrootpart is defined correctly and is working. The error shouldn’t be about it.

the first argument must be a cframe.

local cframe = character:GetPivot()
workspace:Blockcast(cframe, vHitbox.Size, cframe.LookVector * 50, params)
1 Like

oh then its your first perimeter its a vector3 when in blockcasting its suppost to be a cframe here is documentation

1 Like

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