So like in the title that's what I am trying to do, I have some code but it doesn't work...
if script.Parent.Parent.TESTING.Value == true then script.Parent.Sound:Play() elseif script.Parent.Parent.TESTING.Value == false then script.Parent.Sound:Pause() end
Use :GetPropertyChangedSignal
.
local Testing = script.Parent.Parent:WaitForChild("TESTING") Testing:GetPropertyChangedSignal("Value"):Connect(function() if Testing.Value == true then script.Parent.Sound:Play() elseif Testing.Value == false then script.Parent.Sound:Pause() end end)
I bet you could use a loop to fix that, the code you have now only checks if the value is true once.
while true do wait() if script.Parent.Parent.TESTING.Value == true then script.Parent.Sound:Play() else -- you don't need an elseif because the only other possibility is false script.Parent.Sound:Pause() end end
if script.Parent.Parent.TESTING.Value == true then script.Parent.Sound.Playing = true elseif script.Parent.Parent.TESTING.Value == false then script.Parent.Sound.Playing = false end