(example image if you don’t know what I mean by ‘hover’: highlight - Roblox)
I have a script that gets the player’s cursor and changes the id, but it only changes the main cursor and not the hover version, so it looks really weird
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.Icon = 'http://www.roblox.com/asset/?id=9327457518'
How can I also get the highlight one and change it? Cheers.
I’m not entirely sure I’m fully understanding the problem, but when setting a MouseIcon it’s typically preferrable to use the UserInputService MouseIcon
Hover, meaning when your mouse is over something you can click on.
Mouse | Documentation - Roblox Creator Hub
You can use these with GUI events like MouseEnter, MouseLeave, and MouseButton1Down
otherwise its mouse.target to see the workspace object
I’m not sure I fully understand what you mean
so a gui has events and properties
GUI.MouseEnter is the hover over event for guis
if its for the workspace you would have to use mouse.target to get the current part its hovering over
So how would I work that into this script? I’m not too experienced with this sort of stuff.
YouGui.MouseEnter:Connect(function()
-- Change cursour for hover over
end)
YouGui.MouseLeave:Connect(function()
-- Change cursour back
end)
1 Like
Still don’t understand. I am trying to change the image of the mouse, this seems to be a function that happens when it does this.
Would this work if I added your script under mine and just added my own line that changes the ImageID where the function is?
Not quite, so :Connect() connects a function to an event, rather than seperatly defining the function then calling it you can define it within the :connect() to keep things tidy. where i put --Change your cursour thats where you would put the bits to change it.
so from here, this is a built in event of a gui which triggers the connected function when the event fires, so when the mouse enters it would run whats connected to the MouseEnter event
1 Like
It would need to start with the cursor, obviously, so I’m assuming I can just put your code under mine then it would work?
Actually, this wouldn’t work. This has to be for every single thing. I am trying to change the entire cursor not just for one single button. Every clickdetector, every button, literally everything you can click. How would I make this?
you would make a table of uis that would use each cusor and script them all together
local Guis = {Gui1,Gui2} -- Objects, dont just put this
for i = 1,#Guis do
Guis[i].MouseEnter:Connect(function()
-- Change cursour for hover over
end)
Guis[i].MouseLeave:Connect(function()
-- Change cursour back
end)
end
There are also workspace objects this would need to work on. There’s also coregui aswell. There are too many things to just put into a table.
not at all, as for coregui, that shouldnt be used, you would need to override the base roblox guis as you would have issues anyway as many of the core guis are quite restricted. the good thing with tables is you can even auto create them if you want all children or descendants.
I mean the player list and stuff like that. There must be some kind of way to just change the hover id instead of have to individually get every single object (not including parts so it wouldn’t fully work) and then change the mouse.