I'm using a local script so it only pauses for one client and I'm trying to get it to do the same thing except playing it again instead of pauseing
local sp = game.ReplicatedStorage.song.Value
local sc = game.Workspace.MusicScript
function pause()
if game.ReplicatedStorage.pause_and_play_value.Value == "playing" then
game.ReplicatedStorage.pause_and_play_value.Value = "paused_"
while game.ReplicatedStorage.pause_and_play_value.Value == "paused_" do
wait (0.1)
workspace.MusicScript.S1:Pause()
workspace.MusicScript.S2:Pause()
workspace.MusicScript.S3:Pause()
workspace.MusicScript.S4:Pause()
workspace.MusicScript.S5:Pause()
script.Parent.Image = 'http://www.roblox.com/asset/?id=5167333273'
end
end
end
if game.ReplicatedStorage.pause_and_play_value.Value == "paused" then
if sp == 1 then
sc.S1:Play()
end
if sp == 2 then
sc.S2:Play()
end
if sp == 3 then
sc.S3:Play()
end
if sp == 4 then
sc.S4:Play()
end
if sp == 5 then
sc.S5:Play()
game.ReplicatedStorage.pause_and_play_value.Value = "playing"
end
game.ReplicatedStorage.pause_and_play_value.Value = "paused"
end
script.Parent.MouseButton1Click:Connect(pause)

3 comments
This isn't an answer, but just as a suggestion, you would be able to write less code if you put the sound objects into an object and used the parameter as a key
i have no idea what the hell you just said but im going to act like i do
First you made the value become "paused_", and then you're checking if it's "paused" without the "". Remove the "" or make the if statement check if it's "paused_" instead of "paused".