:GetPartBoundsInBox hitbox delay

I’ve been trying to make a simple melee hitbox but it always seems to miss while moving

I’ve tried looking for other forums but cant seem to find any


Thanks! shiva

2 Likes

try setting the networkowner of the hitbox and the melee to yourself so that it doesn’t delay to the client

local Players = game:GetService("Players")

for _, part in model:GetDescendants() do
	if part:IsA("BasePart") then
		part:SetNetworkOwner(Players:GetPlayerFromCharacter(char))
	end
end
1 Like

tried that right now and nothing seems to change

The problem is that you don’t update your parts list:

The code gets the parts in the box the second swing is called, then waits for the Keyframe to do stuff about it (and never checks for more parts).

What you probably want to do is update the parts list inside your while loop, that way it’s constantly getting the parts in the box, instead of just once right when swing is called (e.i. run parts = workspace:GetPartBoundsInBox(...) inside your while loop).


If you haven’t heard of this resource, I would highly recommend it instead of GetPartBoundsInBox for more accurate (and probably more performant) collisions if that’s something you’re looking for:

well that seems to fix the problem! I have used the raycast hitbox, this is just to try to script my own hitbox to get better at scripting

1 Like

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