Bodygyro Flipping When Moving Cursor Too Fast

I’m trying to create an indicator below the player pointing towards where they’d be facing so that other players can know. Using regular CFrame would look fine on the client, but it looks odd on the serverside, which is why I’m using bodyposition and bodygyro. Bodyposition works fine, and the bodygyro seemingly works well until I move my cursor across the screen really fast. I’ve been trying to fix the issue by toying with the properties, but I’ve had no luck.

RunService.RenderStepped:Connect(function()
	local findFloorRay = RaycastParams.new()
	findFloorRay.FilterType = Enum.RaycastFilterType.Blacklist
	findFloorRay.FilterDescendantsInstances = rayIgnoreList
	local floorResults = workspace:Raycast(RootPart.Position, RootPart.CFrame.UpVector.Unit * -999, findFloorRay)
	
	local pCF = CFrame.fromMatrix(
		floorResults.Position,
		Vector3.new(floorResults.Normal.X, floorResults.Normal.Y, floorResults.Normal.Z),
		RootPart.CFrame.RightVector:Cross(floorResults.Normal),
		RootPart.CFrame.RightVector
	) * CFrame.Angles(0, 0, math.pi / -2)
	
	local _, aY = PadCenter.CFrame:ToOrientation()
	
	pCF *= CFrame.fromOrientation(
		0, 
		-aY + math.pi / 2 + math.atan2((Mouse.Hit.p - RootPart.Position).X, (Mouse.Hit.p - RootPart.Position).Z) * 2,
		0
	) 
	
	bGyro.CFrame = pCF * ((RootPart.CFrame - RootPart.Position):Inverse())
	bPos.Position = floorResults.Position
end)

2 Likes

What do you mean when you say it looks odd on the server?

It’s very jittery and most of the time it won’t be seen by other players