Audio pause/play button!

Hiya, I’m trying to make a music play/pause button, and I need some help! I’m still VERY new to scripting, and I think my main problem here is trying to determine if the audio is playing to turn it off.

track = game.ReplicatedStorage.Music.Dark.POSSIBL
script.Parent.MouseButton1Click:Connect(function()
	track.Playing = true
script.Parent.MouseButton1Click:Connect(function()
		if track.Playing = true then,
			track.Playing = false
		end
	
	end
	end)

Try this code instead:

local Track = game.ReplicatedStorage.Music.Dark.POSSIBL

script.Parent.MouseButton1Click:Connect(function()
    if Track.Playing == true then
        Track:Pause()
    else
        Track:Resume()
    end
end)
5 Likes

Solution’s already been given but I’ll just tell you this:
== (double equal sign) is used to check values. = (equal sign) is used to change values.

3 Likes

Actually that’s really helpful for understanding it, thanks!