I’m trying to make my radio have an off and on button but I’m getting errors.
Code for on button:
local Radio = script.Parent
local Click = Instance.new("ClickDetector",Radio)
Click.MouseClick:Connect(function(OnClick)
Radio.Parent.Sound:Play()
end)
Code for off button:
local RadioPart = script.Parent
local Click = Instance.new("ClickDetector",RadioPart)
Click.MouseClick:Connect(function(OnClick)
RadioPart.Parent.Sound:Stop()
end)
local Radio = script.Parent
local Click = Instance.new("ClickDetector",Radio)
Click.MouseClick:Connect(function(OnClick)
Radio.Parent.Base.Sound:Play()
end)
Off:
local RadioPart = script.Parent
local Click = Instance.new("ClickDetector",RadioPart)
Click.MouseClick:Connect(function(OnClick)
RadioPart.Parent.Base.Sound:Stop()
end)
Caused because Sound is in “Base”, not the radio model.
Well, if I don’t have the Sound in a part the music plays everywhere at one volume which I don’t want. Is there a way for this to work the way I’m doing it?