I made this script where when the disc decal is the same id I put, then it should play the song after it rotates to the rotation I gave them. But apparently it didn't do anything. Looks confusing, but I hope you can fix it.
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 and radioOn and disc.Texture == "rbxassetid://238387775" then --if debounce and radioOn is not true and the Image Id is 238387775 then debounce = true -- True radioOn = true -- Radio on arrow.Rotation = Vector3.new(arrow.Rotation.X, 68.578, arrow.Rotation.Z) -- Turn to turn the music on sound.SoundId = "rbxassetid://210232032" -- the Music in this Id sound:Play() --Play it elseif radioOn and sound.SoundId == "rbxassetid://210232032" and disc.Texture == "rbxassetid://238387775" then -- If the radioOn is true and the sound id and decal id is still the same then disc.Texture = "rbxassetid://" -- Disc texture id into nothing, so just plain radioOn = false --Radioon is false sound:Stop() --Stops the sound arrow.Rotation = Vector3.new(arrow.Rotation.X, 45.631, arrow.Rotation.Z) --This arrow should go back before the disc is plain and radioOn is false print("Off" and "PlainDisc") -- prints the Output off and that the disc is Plain debounce = false -- Debounce is false end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Your if statement on line 8 does not perform what you want it to do. Your if statement checks if debounce is not true, radioOn is true and if the disc texture equals "rbxassetid://238387775". You want it to check if debounce and radioOn is false and if the disc texture is "rbxassetid://238387775".
To fix this, you just need to add a not before radioOn on line 8, everything should then work as it should.
Final code:
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 and not radioOn and disc.Texture == "rbxassetid://238387775" then --if debounce and radioOn is not true and the Image Id is 238387775 then debounce = true -- True radioOn = true -- Radio on arrow.Rotation = Vector3.new(arrow.Rotation.X, 68.578, arrow.Rotation.Z) -- Turn to turn the music on sound.SoundId = "rbxassetid://210232032" -- the Music in this Id sound:Play() --Play it elseif radioOn and sound.SoundId == "rbxassetid://210232032" and disc.Texture == "rbxassetid://238387775" then -- If the radioOn is true and the sound id and decal id is still the same then disc.Texture = "rbxassetid://" -- Disc texture id into nothing, so just plain radioOn = false --Radioon is false sound:Stop() --Stops the sound arrow.Rotation = Vector3.new(arrow.Rotation.X, 45.631, arrow.Rotation.Z) --This arrow should go back before the disc is plain and radioOn is false print("Off" and "PlainDisc") -- prints the Output off and that the disc is Plain debounce = false -- Debounce is false end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
I hope my answer helped you. If it did, be sure to accept it.