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

Is there anyway to prevent the mouse GUI cursor from showing up in-game?

Asked by
movsb 242 Moderation Voter
8 years ago

So I have a basic script that will change a local player's mouse icon to a url/decal like so:

local c = script.Parent.Cursor
local p = game:GetService("Players").LocalPlayer
local m = p:GetMouse()
while true do
    if m.Icon ~= c.Image then
        m.Icon = c.Image
    end
    wait()
end

Cursor (referenced as local variable c) is an imageLabel in case there is any confusion, the local script is also in the starterGui. And this local script works fine, however whenever a player hovers his or her mouse on an actual gui in-game, the mouse cursor changes to the black roblox 2016 GUI cursor (https://t7.rbxcdn.com/e11c6baf10eb4b67dc01cc9e32c74c73). Whenever the player's mouse leaves the gui, it goes back to the image in Cursor.Image like normal. BUt what I am wondering is if there is anyway to stop the black gui cursor from appearing whenever you hover your mouse on a gui, and instead keep the cursor as Cursor.Image.

2 answers

Log in to vote
1
Answered by 8 years ago

http://wiki.roblox.com/index.php?title=API:Class/Mouse/Icon mentions that it "may not reflect this property properly."

What you might want to do is set MouseIconEnabled = false and make some kind of ImageLabel follow your Mouse's position.

0
Thanks for that reminder, I will definitely try this out and see how it goes! movsb 242 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

This is not needed. Just use this simple script!

game.Players.PlayerAdded(function(plr)

plr:GetMouse().Icon = 'IMAGE NAME HERE'

end)

That was simpler than you thought! It is only 6 lines of code! So lets explain what I did. So :GetMouse() is, well, getting the player's mouse! Icon is, well, getting the image! A example code.

game.Players.PlayerAdded(function(plr)
plr:GetMouse().Icon = 'rbxassetid://123456' --Just so you know, 123456 is not a valid ID.
end)
0
Oops, forgot to mention when grabbing the ID, subtract 1 from the digit. For example, if the ID is 544544, then it would be 544543 SH_Helper 61 — 8y
0
I already did that, my problem is that the mouse Icon is overridden when it hovers over a gui. Thanks for trying to help tho. movsb 242 — 8y

Answer this question