#hitbox being in the wrong spot
1 messages · Page 1 of 1 (latest)
function Hitbox:HitboxCreation(humrp, dmg, size, Pos)
local userChar = humrp.parent
local DebrisService = game:GetService("Debris")
local hitBoxPart = Instance.new('Part')
hitBoxPart.Name = "hitBoxPart"
hitBoxPart.Anchored = true
hitBoxPart.CanCollide = false
hitBoxPart.Size = size
hitBoxPart.Position = Pos
hitBoxPart.Rotation = humrp.Rotation
hitBoxPart.Parent = workspace
hitBoxPart.Transparency = 0.5
hitBoxPart.CastShadow = false
DebrisService:AddItem(hitBoxPart, 4)
local foundParts = workspace:GetPartsInPart(hitBoxPart)
for _, v in foundParts do
if v.Parent:FindFirstChild("Humanoid") and userChar ~= v.Parent then
local HL = Instance.new("Highlight")
HL.Parent = v.Parent
HL.FillColor = Color3.new(1, 1, 1)
HL.OutlineTransparency = 1
DebrisService:AddItem(HL, 0.3)
v.Parent.Humanoid:TakeDamage(dmg)
break
end
end
end
return Hitbox```
its cus ur walking
YEAH BUT LIKE I DSIABLE TO THE CONTROLS WHEN PRESSING E
its because the server receives your character's previous position, but you moved during the calculation of the hitbox, so that is why it looks offset. In order to fix this, you can predict the character's movement through velocity predictions
does this include m**h
i hate 1 + 1
nothing too advanced


well... how do i do velocity predictions
get velocity of humanoidrootpart and like divide it and add that to the hitbox position idfk
theres prolly some solid equation for it
thanks very helpful... how do i get teh velovity-
Assemblylinearvelocity
im shit at math barely passing it
what grade ru in
im shit at math thats all that matters kay
did a work around by making it disable your controls 0.23 seconds before it actually fires the server to make the hitbox im so smart