while true do wait(.1) if script.Parent.Parent == StarterGui then script.Parent.Playing = false end if script.Parent.Parent == PlayerGui then script.Parent.Playing = true end end
There is a much simpler solution to this. Because LocalScripts only run in the Player, NOT the server, have the audio default as Playing = false. Then, in the local script, simply put
script.Parent.Parent.Playing = true
So when the player gets the audio, it immediately toggles it to start playing. Hope this helps!