So i am not asking how to put a sound when u click a TextButton but like when the mouse is on it but didn't clicked.
✓ ANSWER ACCEPTED
How do you add sounds when you get over a TextButton?
1 answer
✓ Accepted answer
Well, you can use MouseEnter function provided by Roblox. It will detect whether the mouse has entered the TextButton. Also, you can use MouseLeave to detect if the mouse left the TextButton.
A sample code:
-- Local Script inside the TestButton
local TextButton = script.Parent
local function Enter() -- Creating a local function
local sound = Instance.new("Sound") -- Creates a sound object
sound.Parent = TextButton
sound.Name = "TestSubject"
sound.SoundId = "rbxassetid://12345678" -- An example
sound:Play()
end
local function Leave()
local Sound = TextButton:FindFirstChild("TestSubject")
if Sound then -- If the Sound object is found
Sound:Stop() -- Stops the sound
end
end
TextButton.MouseEnter:Connect(Enter)
TextButton.MouseLeave:Connect(Leave)
Lemme know if it helps!
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
It does work! Than you so much!!!
It will be helpful if you mark it as the answer
This happens often here, I'll accept it for you; you can use hyperlinks with the integrated StackEdit, it would be more educative to include documentation links to these RBXScriptSignals.