Updating player positions more accurately

A common issue in a lot of fighting games on ROBLOX is the hitbox lagging behind the player due to replication time. I have recently found a workaround for this and now how a single part (roughly the size of the player) replicating to the more updated position. However a minor issue to this is that the blue block representing the more accurate position is disjointed from the model for other players.

Currently I am using this

for _,Target in next,game.Players:GetChildren() do
		if Target ~= Player then
			Target.Character.HumanoidRootPart.Anchored = true
			local Hurtbox = Target.Character.HurtBox
			Hurtbox.Parent = workspace
			Target.Character:PivotTo(Hurtbox:GetPivot())
			Hurtbox.Parent = Target.Character
		end
	end

every time PreSimulation is fired, I doubt this is the best way to do it and as such I’m wondering if anyone knows a better way. I will can post videos if anyone needs it to help with visualization

1 Like

To address the hitbox lag issue more efficiently, you can update the player positions more smoothly and avoid the disjointed model appearance for other players. Here’s an improved approach using the Heartbeat event for smoother updates:

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

RunService.Heartbeat:Connect(function()
	for _, Target in ipairs(Players:GetPlayers()) do
		if Target ~= Player then
			local Character = Target.Character
			if Character and Character:FindFirstChild("HumanoidRootPart") and Character:FindFirstChild("HurtBox") then
				local Hurtbox = Character.HurtBox
				Character.HumanoidRootPart.Anchored = true
				Hurtbox.CFrame = Character.HumanoidRootPart.CFrame
			end
		end
	end
end)

Apologies for the confusion, but the Hurtbox CFrame is more accurate than the current Characters CFrame, the goal is to make the Characters model updated to the Hurtbox CFrame

1 Like

UPDATE: as I was not able to link a video earlier I am showing it now

This is effect of the current method I am using, I’m unsure why but when ingame players seem to update at a much slower fps causing them to “jitter”


(This is me replicating the effect in studio)

(This is how the effect looks normally in studio)

When disabling this effect it shows the disjoint I was referring to


As I mentioned earlier I found a workaround to the hurtbox/hitbox lagging behind the player. but with the method Im using to minimize this effect it has caused the player model to lag behind the hurtbox/hitbox without using the secondary method to lock other players models to their hurtbox from the client

1 Like

I recommend using Stepped or RenderStepped instead of heartbeat
should update more fluently.
(not sure tho)

There’s no method to perfectly eliminate latency lag, just do the collisions on the client so it feels smooth and then verify/sanity checks on the server if the hits are real

RenderStepped is client sided only

1 Like

This is a client sided effect, I am updating the position of the player more accurately than the way roblox’s replication speed, I am requesting help on if theres a way to make the models of other players reach the same position as the more accurate position smoothly since the current method I am using causes the jitter I referenced in the videos above

1 Like

I am not using Heartbeat, as said in the post I am using PreSimulation:Connect()

There isn’t unless you can predict player movement. I’m guessing you’re looking for a server authoritative character controller system so I’d recommend looking into Chickynoid.