Goal: Fix the FE Gun Kit issue where the crosshair dot moves when you change from fullscreen to windowed. This bug also occurs when you change FOV.
Issue: As stated, the crosshair is offset when aiming in ironsights when I change screen size (note: I am using the latest FE gun kit version with viewmodel)
Solutions attempted: I tried using chat-gpt with no avail.
Examples of the bug (one is fullscreen and one is in the smallest window you can make the roblox window. (If you are familiar with the Fe Gun kit, the white dot is basically where the bullet will hit in the crosshair. Its off center since it needs to be manually adjusted in the function I posted below with the x/y-axis. I do not know of a permanent solution where the viewmodel aimpoint aligns with this dot.)

Here is the update crosshair function found in the Gunclient script:
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 - 36) or UDim2.new(0, v2.X, 0, v2.Y - 36)
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 (Camera.Focus.p - 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 (Camera.Focus.p - 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 - 36) or UDim2.new(0, v2.X, 0, v2.Y - 36)
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
Thank you. I appreciate any help.
Also for future reference if anyone sees this thread, here is a bug fix I uploaded for when your arms disappear when you equip a second gun: ViewmodelHandler(Fixes FE Gun Kit) - Creator Store