How to make the frame gui follows the crosshair

how can i make this Frame gui makes it follows the players crosshair
so far have this and it didn’t work oof

while true do
	local Button = script.Parent
	Button.HoverMouseFrame.Position = game.Players.LocalPlayer:GetMouse().Icon.Position
	wait()
end

I think the mouse has no position property
but it has the offset that is separated

local Mouse = game.Players.LocalPlayer:GetMouse()

Mouse.Move:Connect(function()
	Button.HoverMouseFrame.Position = UDim2.new(0, Mouse.X , 0, Mouse.Y)
end)
1 Like

ah i though it has one, but thanks for letting me know

for more accurate positions do

local Mouse = game.Players.LocalPlayer:GetMouse()
local UserInputService = game:GetService("UserInputService")
Mouse.Move:Connect(function()
    local Mouse = UserInputService:GetMouseLocation()
	Button.HoverMouseFrame.Position = UDim2.new(0, Mouse.X , 0, Mouse.Y)
end)
1 Like