I am making a radio where if I put the CD in and click the arrow to its position, it will turn on. Well, instead, when I clicked without the CD in, it played the music. I am trying to do this. I click on the GUI to put the CD in, once I click it, it will change the texture of it. And whatever the texture it is, it will play the music of it after I click On. Well, it didn't do it. Please look over it. If it is still confusing, then, I will see what I can do!
local arrow = game.Workspace.Arrow
local disc = game.Workspace.PlainDisc2.Decal
local sound = Instance.new("Sound", disc)
debounce = false
radioOn = false
function onClicked() -- Clicked
if not debounce then
debounce = true
if not radioOn then
radioOn = true -- Turn Radio on
disc.Texture = "rbxassetid://238387775" --Uptown Funk
sound.SoundId = "rbxassetid://235468324"
arrow.Rotation = Vector3.new(90, 45.631, -180) -- Turn to turn the music on
sound:Play() --Play it
elseif radioOn then
disc.Texture = "rbxassetid://98698696" --Gangnam Style
sound.SoundId = "rbxassetid://130844430" --Play Gangnam Style
arrow.Rotation = Vector3.new(90, 45.631, -180) -- Turn to turn the music on
sound:Play() --Play it
elseif radioOn then
disc.Texture = "" -- Set Disc texture to nothing
radioOn = false -- Turn Radio off
sound:Stop() --Stops the sound
arrow.Rotation = Vector3.new(-90, -45.631, 0) --This arrow should go back before the disc is plain and radioOn is false
print("Off\n".."PlainDisc") -- prints
end
debounce = false
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
