I have been trying to create a sound every time your mouse leaves and enters this button. The code doesn't really work. I have tried this on a local script and a normal script:

script.Parent.MouseEnter:Connect(function()
    local sound = script.Parent.Parent.hit
    sound:Play()
    
end)

script.Parent.MouseEnter:Connect(function()
    local soundTwo = script.Parent.Parent.hitS
    soundTwo:Play()

end)
```[enter image description here][1]


  [1]: https://i.stack.imgur.com/5niz4.png -- The explorer of the game (I used script and local script btw and none of them changed anything, but i do think local script would work better for a gui)
1

There are 1 best solutions below

1
Tsering On

You can try adding the following lines at the top of your code.

if not sound.IsLoaded then sound.Loaded:Wait() end
if not soundTwo.IsLoaded then soundTwo.Loaded:Wait() end

Also, both of your functions are for MouseEnter. Try changing one to MouseLeave.