check if the insatnce youre passing exists or not and wether its nil
Iâm also experiencing this issue. When itâs not my region, the hitbox will simply not hit anything (client-sided ones).
The module seems good, however could be updated ^ had to rework some stuff due to region issues
i had an issue where it kept firing HitSomeone Connection even though iâve stopped the hitbox, im typing this so it can be helpful for other users who could have the same issue.
it might be our timing fault that we call the :Start() function which starts the hitbox while the âRunServiceConnectionâ is Still running, so it overrides it and makes it impossible to disconnect the hitbox event. for this i made sure that it disconnects the Connection before Opening a new one and that fixed the problem for me
Just make sure you disconnect the connection if it exists right after the Start function
> function Hitbox:Start()
> if self.RunServiceConnection and typeof(self.RunServiceConnection) == `RBXScriptConnection` then
> self.RunServiceConnection:Disconnect()
> end
and that fixes it!
You canât adjust the VelocityPrediction so i made it adjustable ( added: VelocityPredictionFactor ) <3
Use cases:
- For example your character is at a âfastâ paced movement (50 - 100 velocity), youâll have to change VelocityPredictionFactor to 5, and that predict the characterâs velocity properly.
- Normal VelocityPredictionFactor would be 6 for more âslowâ paced movements of the character
function Hitbox.New(HitboxParams)
-- Rest of the Code stuffs here
--
--
-- ...
self.VelocityPredictionFactor = HitboxParams.VelocityPredictionFactor or velocityConstant.Value or 6
-- Rest of the Code stuffs here
--
-- ...
return self, true
end
function Hitbox:SetPosition(newPos)
local predFact = self.VelocityPredictionFactor or 6
if RunService:IsServer() and self.PartWeld and self.VelocityPrediction then
local velocityVector = newPosition:VectorToObjectSpace(self.PartWeld.AssemblyLinearVelocity) / predFact
newPosition = newPosition * CFrame.new(velocityVector)
end
self.Position = newPosition
if self.Part then
self.Part.CFrame = newPosition
end
end
Does anyone else have a problem with it not detecting characters if theyâre jumping?