Sound when Hover over a button

I am trying to make it so whenever a player hovers over a button, theres a sound. I already have my sound Id: 15147228195
I tried some scripts I found on other posts but none of them worked. Can someone help?

2 Likes

Hello! Wrong post category by the way. Please post in the scripting support category

1 Like

this is a LOCALSCRIPT. put it in your gui.
And please read how it works, devforum isn’t just for free answers, try to learn.

local Everything = script.Parent:GetDescendants()
local Hoversound = script.Parent.HoverSound -- Change name to your sounds name or name your hover sound "HoverSound"
local Clicksound = script.Parent.ClickSound -- If you want a clicking sound, then do the same as the hover sound but with this one.

for _,v in pairs(Everything) do -- Goes through your ui
	if v:IsA("TextButton") or v:IsA("ImageButton") then -- Checks if there's any buttons
		
		v.MouseEnter:Connect(function() -- This is what makes it do the hover sound.
			Hoversound:Play() -- plays the sound
		end)
		v.MouseButton1Click:Connect(function() -- Click sound 
			Clicksound:Play()
		end)
	end
end

Your hierarchy should look like this
image

2 Likes

nvm found out how to make it work ty

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.