Problem with with cursor tracking?

So basically what this does is just that there’s supposed to be a crosshair tracking the mouse, but then it offsets depending on the window size?? I don’t know how to explain it, it’s weird.

local Player = game:GetService("Players").LocalPlayer
local MainHolder = script.Parent:FindFirstChild("MainHolder") MainHolder.Visible = true
local MainFrame = MainHolder:FindFirstChild("Main") MainFrame.Visible = true
local Mouse = Player:GetMouse()

Mouse.Move:Connect(function()
	MainHolder.Position = UDim2.new(0, Mouse.X, 0.05, Mouse.Y)
end) 

why are you having a crosshair follow the mouse when you could replace the mouse icon entirely with
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

mouse.Icon = “rbxassetid://0000000”

GUI offset is caused by incorrect sizing or positioning relative to a users screen, so I’m going to assume that’s caused by you not correctly scaling it.

Also, Mouse.Move is not the way you should be tracking a users mouse input.

local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

local gui = script.Parent
local mainHolder = gui.MainHolder
local mainFrame = mainHolder.Main

mainFrame.Visible = true
mainHolder.Visible = true

RunService:BindToRenderStep("name_of_stepped_loop", Enum.RenderPriority.Camera.Value - 1, function()
    if (UserInputService.MouseEnabled) then
        local cords = UserInputService:GetMouseLocation()
        mainHolder.Position = UDim2.new(0, cords.X, 0, cords.Y)
    end
end)