Crosshair acting weird

So I am creating a custom cross hair, which is in a frame, the idea was to just put the crosshair where the players mouse is, which uh, yeah it just wont go there :sob:

For whatever reason it’s usually above the mouse, so I just started subtracting a certain offset from the position to get it at the mouse’s position, but guess what? Now the crosshair for absolutely no reason what so ever keeps going back to the original position and ignoring the fact that I am subtracting a number from it, thus causing this bobbing effect which is really annoying.

I found out that by setting the ScreenInsets property to CoreUISafeInsets it works fine, but it squashes the other UI elements that are in the ScreenGui, I can take them out, but its much cleaner having it all in one GUI, so I was wondering if anyone knows how to fix this, thanks!

					CrosshairConnections['Mouse'] = Mouse.Move:Connect(function()
						if not CameraModule:IsFirstPerson() then
							Crosshair.Position =  UDim2.fromOffset(Mouse.X, Mouse.Y + 50)
						end
					end)

Crosshair refers to a Frame that is well, the Crosshair. Mouse is the players Mouse.

well it sounds like there’s another loop somewhere that’s sertting the crosshair’s position.

and to get the correct subtraction amount, use GuiService:GetGuiInset() to work on all of topbars I think

1 Like

Why not just use UserInputService.MouseIcon?

Im making a dynamic crosshair, so setting the icon sadly wont do with the amount of variety it can have.

Ok Ill try this out right now!

3 Likes

sadly the same issue persists, not the bobbing, but the crosshair isnt in the same position

					local Inset = GuiService:GetGuiInset()
					
					Crosshair.Position =  UDim2.fromOffset(Mouse.X, Mouse.Y + Inset.X)
					
					CrosshairConnections['Mouse'] = Mouse.Move:Connect(function()
						if not CameraModule:IsFirstPerson() then
							
							Crosshair.Position =  UDim2.fromOffset(Mouse.X, Mouse.Y + Inset.X)
						end
					end)

it should be inset.Y not x and if it still isn’t right try subtraction the inset.Y instead of adding

3 Likes

Ok yeah I just put in the wrong thing :sob:

I figured out the cause of the bobbing bug, so thanks! Let me set you as the solution!

1 Like