Ad
Log in to vote
0

How do I add a sound effect when the button is hovered over?

Asked by 2 years ago
Edited 2 years ago

Heya guys, this is my first question apparently. Well, I'm trying to make a button that makes a sound effect when the mouse is hovering over it. I don't know how to make a script for it so I'll need some help.

The Script I attempted,

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Parent.RulesFrameG.Visible = true
    script.Parent.Parent.Visible = false

    -- >>Sound Effect on hover over.

    -- >> Services
    local UserInputService = game:GetService("UserInputService")

    -- >> GUI Elements
    local GRules = script.Parent

    -- >> Player's Mouse
    local mouse = game.Players.LocalPlayer:GetMouse()

    -- >> Sound
    if GRules.MouseEnter = true
        then script.Parent.FindFirstChild:("Sound")
            Sound.Playing = true
        end
end)
0
There is a mouse Enter Event Nguyenlegiahung 1091 — 2y
0
Yeah, so..? Dragonboy99711 5 — 2y

1 answer

Log in to vote
1
Answered by
Despayr 505 Moderation Voter
2 years ago
Edited by youtubemasterWOW 2 years ago

Since you haven't attempted code, I can only link you to the roblox developer site.

MouseEnter is what you are looking for

https://developer.roblox.com/en-us/api-reference/event/GuiObject/MouseEnter

0
Oh, alright. Dragonboy99711 5 — 2y
0
Also your link is blocked. Dragonboy99711 5 — 2y
Ad

Answer this question