So I was browsing roblox as usual. I found this game that had this feature where is my mouse hovered on top of the GUI (image) it would make a light hover sound. Therefore I was wondering is it possible if HoverImage can detect the mouse and make that sound or if the gui detects the mouse and makes that sound. Because I literally dug through this on the devforum, youtube even took it as far as searching my toolbox but found nothing. This is script related. So does anyone know a hoverdetect script? Not a follow-cursor gui or a clickdetect script.
I also happened to stumble apon this BasePlayerGui:GetGuiObjectsAtPosition
Thank you! All responses are highly appreciated!
2 Likes
There is an API for this.
2 Likes
Anyone who stumbles upon this and wants an answer please do use this script:
script.Parent.MouseEnter:Connect(function(x, y) -- If mouse touches script then
script.Parent.Sound:Play() -- Insert Script here
end)
-- Insert this script on a GUI
-- Insert the Sound on the GUI, not Inside the Script.
-- MUST BE A LOCALSCRIPT!
-- by Wrvel
or
Roblox Scripting Tutorial - MouseEnter and MouseLeave - YouTube
1 Like
I wouldn’t recommend using the MouseEnter and MouseLeave events as they’re inconsistent and awful in general to use. I’m not sure if you want the sound to stop playing as soon as MouseLeave fires but this would be more beneficial if you’re doing that.
You can use this module:
1 Like
If you’re just playing a sound it doesn’t actually matter. Sometimes either of the events don’t fire, which can cause problems for other things. Playing a sound is fine unless, like you said, you want the sound to stop on MouseLeave. Otherwise MouseEnter is a good choice.
1 Like