I’m trying to implement raycast hit detection into the gun that I’m currently making. The raycast starts at the muzzle position of the gun & goes in the direction of the player’s mouse.hit.Position. The problem is that the muzzle position isn’t accurate
…until I switch from server then back to the client, as shown in this video:
What’s being printed in the output is the Y value of the muzzle part’s position.
Some things to take not of is that the muzzle part is a descendant of CurrentCamera (in the workspace) and only exists on the client, as it’s a part of a viewmodel.
It seems it’s taking a long time to update the muzzle part’s position because if I just sit in the game for a while, eventually it’ll start giving me an accurate muzzle position. Still don’t know how to fix/get around this
All I had to do was anchor one of the parts in my view model to make all the rest of the parts welded/motor6ded to it immune to Roblox’s physics, which I believe was causing the bug, as ChatGPT implies.
I still don’t know why before I came to this solution, switching to the server, then back to client during playtesting fixed this bug though, lol