It's been a while since I have been scripting or to even come to this site. Anyway, I am having trouble with getting the SoundId
to play with the ImageId
. Hope you know what I mean based on this script.
local arrow = game.Workspace.Arrow local disc = game.Workspace.PlainDisc2.Decal local sound = Instance.new("Sound", disc) sound.SoundId = "rbxassetid://210232032" 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 arrow.Rotation = Vector3.new(90, 45.631, -180) -- Turn to turn the music on sound:Play() --Play it if not radioOn then radioOn = true -- Turn Radio on disc.Texture = "rbxassetid://98698696" --Gangnam Style sound.SoundId = "rbxassetid://163211519" --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)
Thank you so much for the help!
It is not playing the sound because you are...
To fix this, make sure you change the SoundId property of the sound and don't change the texture property of the decal unless it's an IMAGE you are changing it to.
Fixed script:
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://210232032" arrow.Rotation = Vector3.new(90, 45.631, -180) -- Turn to turn the music on sound:Play() --Play it if not radioOn then radioOn = true -- Turn Radio on disc.Texture = "rbxassetid://98698696" --Gangnam Style sound.SoundId = "rbxassetid://163211519" --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)
On second thought, I don't really understand what you are asking. Hopefully I have answered your question, if I didn't tell me what you are still confused about.