Crosshair not centered after the new update

I’ve just gotten this problem today, a minute ago. The crosshair is not at where it supposed to be.
It is below my mouse, a bit. I have no idea how to fix this, please help.

My cursor is right there.


But when i equip my gun, the crosshair is below my cursor.

The position of the crosshair gui is 0,0 so its supposed to be in the middle of the screen.

My guess is, the new roblox update did it, or a bug. (this problem happened after the new menu update thingy)
I tried to fix it, but failed. Please help!
(ps im using fe gun kit)
(ps2 its fine playing in roblox player)

LAST EDIT : I FOUND THE SOLUTION, JUST TOGGLE THE MODERNIZED MENU OFF IN THE BETA FEATURE. ( im stupid )

3 Likes

Is IgnoreGuiOffset set to true on the crosshair gui?

3 Likes

On second thought, maybe its the gun kit you are using? when I take a gun kit
from the toolbox and it seems to work fine!

Studio Debugging
Edit: Never mind! It still seems to be bad upon further inspection
Oops!

No, i didnt set to true
when i set it on it to true, the crosshair is very above my cursor.
you mean IgnoreGuiInset?

Oh, My Bad

charssssssssss

Ive found the line of code that sets the offset of the crosshair, I’ll tinker with it
until I find something good!

				GUI.Crosshair.Position = (v - v2).Magnitude > 0.08 and UDim2.new(0, v.X, 0, v.Y - 36) or UDim2.new(0, v2.X, 0, v2.Y - 36)

the -36 here is to account for IgnoreGuiOffset being disabled.

1 Like

Infact, theres a whole function for this!

local function UpdateCrosshair()
	if UserInputService.MouseEnabled and UserInputService.KeyboardEnabled then --For pc version
		if FakeCamera then
			CFAngles = CFrame.fromEulerAnglesXYZ(FakeCamera.Transform:ToEulerAnglesXYZ()) or CFrame.new()
			if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 then
				if CFAngles then
					local v = WorldToScreen((Camera.CFrame * CFAngles:Inverse() * CFrame.new(0, 0, -4)).Position)
					local v2 = Camera.ViewportSize / 2
					GUI.Crosshair.Position = (v - v2).Magnitude > 0.08 and UDim2.new(0, v.X, 0, v.Y - 40) or UDim2.new(0, v2.X, 0, v2.Y - 40)
				else
					GUI.Crosshair.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y)
				end	
			else
				GUI.Crosshair.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y)
			end
		else
			GUI.Crosshair.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y)
		end   
	elseif UserInputService.TouchEnabled and not UserInputService.MouseEnabled and not UserInputService.KeyboardEnabled and (Character.Head.Position - Camera.CoordinateFrame.p).Magnitude > 2 then --For mobile version, but in third-person view
		GUI.Crosshair.Position = UDim2.new(0.5, 0, 0.4, -50)
	elseif UserInputService.TouchEnabled and not UserInputService.MouseEnabled and not UserInputService.KeyboardEnabled and (Character.Head.Position - Camera.CoordinateFrame.p).Magnitude <= 2 then --For mobile version, but in first-person view
		if FakeCamera then
			CFAngles = CFrame.fromEulerAnglesXYZ(FakeCamera.Transform:ToEulerAnglesXYZ()) or CFrame.new()
			if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 then
				if CFAngles then
					local v = WorldToScreen((Camera.CFrame * CFAngles:Inverse() * CFrame.new(0, 0, -4)).Position)
					local v2 = Camera.ViewportSize / 2
					GUI.Crosshair.Position = (v - v2).Magnitude > 0.08 and UDim2.new(0, v.X, 0, v.Y - 40) or UDim2.new(0, v2.X, 0, v2.Y - 40)
				else
					GUI.Crosshair.Position = UDim2.new(0.5, 0, 0.5, -19)
				end	
			else
				GUI.Crosshair.Position = UDim2.new(0.5, 0, 0.5, -19)
			end
		else
			GUI.Crosshair.Position = UDim2.new(0.5, 0, 0.5, -19)
		end
	end
end
1 Like

Reminder : it happened only in roblox studio

After a bit of tinkering, I believe I found a number that should work!

Instructions:
Enter the GunClient script in your gun
Go to line 641
You should see a function called UpdateCrosshair, if not, use find to search for it
Once you’ve found the function, replace all the lines with this text!
Replace
GUI.Crosshair.Position = (v - v2).Magnitude > 0.08 and UDim2.new(0, v.X, 0, v.Y - 36) or UDim2.new(0, v2.X, 0, v2.Y - 36)
with
GUI.Crosshair.Position = (v - v2).Magnitude > 0.08 and UDim2.new(0, v.X, 0, v.Y - 56) or UDim2.new(0, v2.X, 0, v2.Y - 56)
It should be done by now, and here proof it works!

Nice and fixed! (hopefully)
Disclaimer: This *might* end up giving a slight offset to the bullet, since I only modified the crosshair and not where the bullet fires.
1 Like

Works, thanks!!!

No problem :slight_smile:

charsssssssssssssssssssssss

i got a question… do you know how to change from the new menu to the old menu…?

nvm, i fixed it now!!!

Well, If you are talking about the roblox menu, I saw a post about that and it said that
that’s in coregui, which cant be modified with scripts.
Some games may still have the old roblox gui, but that’s because they were made
before roblox changed the UI, and the post said the new ui would eventually affect
every game on the platform

This is a sad day for old roblox likers

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.