When walking backwards the hitbox spawns super far away from where I am. When walking forwards it spawns behind me somewhat. Is there a way to fix this while keeping the hitbox on the server?
You can try welding the hitbox to the player’s character
If you’re setting the position of the hitbox from the server, there will be a desync since the client and the server have two different views on where the player is
Pretty much what @HugeCoolboy2007 said
Server is delayed, thus when walking in a certain direction, the client sees you further forward/behind then where the server sees you, so it’d be better if you had the client do the hitboxes.
If you have client-sided hitboxes make sure to properly secure your remotes!
However, you could account for ping - this would help with it, but make sure you limit it, just in case exploiters try to spoof their ping.
It actually wouldn’t, because if you have parrying in your game then the client can delay the time between receiving the players who were in the hitbox.
A few solutions to this issue, including: Lag Compensation - Valve Developer Community
Client simply passes the time when they fire the remote. Have a bin of old hitboxes that are deleted for example 1 second after creation so the server doesn’t get overloaded and leggier players cant deal damage when they have extremally bad lag.
Try creating another part and have it welded to the HumanoidRootPart then add a attachment and add offset to the attachment based on the position of the hitbox then finally, add another attachment for the hitbox then add align position and align rotation, connect them to that two attachments. Idk if it works but I tried it and I forgot
That wouldn’t change anything. The server would still see the player one unit of latency behind where the player is on their own screen.
It is practically always a better option to use client-sided hitboxes.