Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make the mouse icon change when it is hovering over a part?

Asked by 4 years ago

How do I make the mouse icon change when it is hovering over a part?

0
You could always just attatch a Click Detector to the part/model, but that might not be the effect you are looking for. eyeball001 7 — 4y

1 answer

Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

You can use the Cursor’s .Target property to read the current BasePart the Cursor is hovering over. Using a conditional, we can compare the Objects to filter for one specific Instance.

Then, using .CursorIcon, we can change the Icon through a decal ID.

local Player = game:GetService("Players").LocalPlayer
local Cursor = Player:GetMouse()

local SetIcon = --// Id Here

local Part = workspace.Part

Cursor.Move:Connect(function()
    if (Cursor.Target == Part) then
      Cursor.CursorIcon = "rbxassetid://"..SetIcon
    end
end)

If this helps, don’t forget to accept this answer!

Ad

Answer this question