Making a making a hitbox more accurate?

Assuming your hitbox is a part with CanCollide false, you can call Part:GetTouchingParts as long as you have a function connected to its Touched event. The cool part is that the function binded can be empty, aka function() end.
There is another game that I have asked this question to which involves hitboxes, and they use magnitude checks instead of actual hitboxes to detect hits, which is inaccurate but still fast.

local hitbox = --Part 
--Using Part:GetTouchingParts local newHitbox = hitbox:Clone() newHitbox.CFrame = --wherever its supposed to be local localHumanoid = --local player's humanoid newHitbox.Touched:Connect(function() end) local alreadyHit= {[localHumanoid] = true} for _,hit in pairs(newHitbox:GetTouchingParts()) do	if HumanoidWasFound() and not alreadyHit[humanoid] then	humanoid:TakeDamage(--[[damage]])	alreadyHit[humanoid] = true	end end newHitbox:Destroy() 
--Using magnitude checks local newHitbox = hitbox:Clone() newHitbox.CFrame = --wherever its supposed to be local distance = --number for _,player in pairs(Players:GetPlayers()) do	if player ~= LocalPlayer and CharacterWasFound() and HumanoidWasFound() then	--you can also just check for the torso or even create custom	--hurtboxes if you want it to be faster	for _,part in pairs(character:GetChildren()) do	if part:IsA("BasePart") and (part.Position - newHitbox.Position).Magnitude <= distance then	humanoid:TakeDamage(--[[damage]])	break	end	end	end end newHitbox:Destroy() 

I should note that both snippets deal damage on a per hitbox per character per frame basis, and that both would need to be used and optimized for a connection to RunService most likely.

Quick plug:

13 Likes