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

is there a script to change players mouse icon to the same image for all ClickDetectors in the game?

Asked by 5 years ago

hey... so im working on a horror game, and i wanted to change the players cursor to a simple black dot, and then once they hover over ANY ClickDetector, then it would change to a simple hand icon, and then back again once it is NOT hovering over a ClickDetector.

im not fantastic at scripting, and im honestly suprised there is no easier way to change such a practical thing, but Roblox do what Roblox do...

any help would be great.

1 answer

Log in to vote
0
Answered by 5 years ago

You can try these 2 local scripts I use, of course replace ""whatever"" with the Asset ID you need. You'll need to put them into StarterGUI.

function Search(ItemToSearch)
    for i, v in pairs(ItemToSearch:GetChildren()) do
        if v:IsA("ClickDetector") then
            v.MouseHoverEnter:connect(function(Player)
                local Mouse = Player:GetMouse()
                Mouse.Icon = "whatever"
            end)
            v.MouseHoverLeave:connect(function(Player)
                local Mouse = Player:GetMouse()
                Mouse.Icon = "whatever"
            end)
        end
        Search(v)
    end
end

Search(workspace)

I don't know if a professional would recommend this, but atleast it works for me.

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

local texture = "whatever"

mouse.Icon = "whatever"
0
Thanks dude! The first script should work just fine, im just suprised Roblox hasn't made it easier to change both so that they work together, instead of one permanently staying the mouse icon. dominicjj54321 8 — 5y
0
The second script changes the cursor from the start. Unity_456 47 — 5y
0
And the two "whatever"s in the first script are 2 icons which you need to place. Unity_456 47 — 5y
0
it works perfectly! thanks dude, i spent a good 2 hours tryina get it to work before. dominicjj54321 8 — 5y
Ad

Answer this question