This should have an easy answer, I do this kind of functions all the time, I don't know why this isn't working!!
script.Parent is a TextButton, so that's not the problem. The only problem is with the function, nothing inside, it doesn't detect the click. I hope you can find a solution.
function a()
local plr = game.Players.LocalPlayer
if plr:GetRankInGroup(2990423)>= 3 then
if script.Parent.Parent.Playing.Value == false then
script.Parent.Parent.Playing.Value = true
script.Parent.Announcement:Play()
elseif script.Parent.Parent.Playing.Value == true then
script.Parent.Parent.Playing.Value = false
script.Parent.Announcement:Stop()
end
end
end
script.Parent.MouseButton1Click:connect(a)

6 comments
add a print('Hello!') right after the function a() line, to see if it comes into the function.
Make sure the text button isn't covered up at all, and is active. Also do what Ruben said, it's good to debug things and test if functions are actually being called or not. And finally, you should use :Connect because :connect is now Deprecated and could be removed at any time.
Also make sure this is in a local script
Is this the full code or might you have an infinite loop before the event? Also, try doing as RubenKan suggested and try debugging your code.
Thanks! I'm sorry I can't upvote. I tried what Ruben said before, it doesn't call the function, I'll try putting it in a LocalScript and I'll change :connect for :Connect. That's the whole script, how do I debug it?
I tried every sigle advice, none worked. :(