Mouse moving image UI

Hello,

Can anyone tell me how i can make my player’s mouse move an image instance when their mouse hovers over an image just like a camera’s CFrame?

Help would be appreciated.

local label = yourlabellocation

label.MouseEnter:Connect(function()
    --some code when mouse enter
end)

label.MouseLeave:Connect(function()
    --some code when mouse leave
end)

if it helped pls mark my anwser as solution

Not exactly what i meant sorry i had to be more specific but i know it’s some sort of code with RenderStepped. Just like when the player’s mouse moves with Vector3D but on an ImageLabel.

you need script that detects if player`s mouse moving? or you need a script that will move your ImageLabel to your mouse?

You can try utilising the player’s Mouse object. This must be done on the client.

local runService = game:GetService("RunService")
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()

local function onStep(step)
    local mousePos = Vector2.new(mouse.X, mouse.Y)
    --do stuff with mouse pos here
end

runService:BindToRenderStep("MouseThingy", 2000, onStep)

The easiest way to achieve this would be to utilize the “GetMouseLocation” method from the UserInputService. Implementation may vary, but you would set the position of the gui element to a UDim2 representing the mouse position every frame.