So, I made a music player where at the moment, whenever you toggle to mute the player, it switches from one label - unmuted, to another label - muted.
I’m trying to make it so instead of using 2 labels to accomplish 1 function, I want to be able to just toggle different transparencies for when it is activated or deactivated.
For example: 0.5 is unmuted while 0 is muted
MusicStop.MouseButton1Click:Connect(function()
if MusicStop.IsStopped.Visible then
MusicStop.IsStopped.Visible = false
SoundPlayer:Play(); raiseSound:Play()
else
MusicStop.IsStopped.Visible = true
dimSound:Play(); dimSound.Completed:Wait()
SoundPlayer:Stop()
end
end)
This is the code i’m working with, I think I just need to change the if else statement and the conditions, but i’m not sure how to do that.
At default: 0.5 ImageTransparency
When clicked on: Switched to 0 ImageTransparency || Song is Muted
When clicked on again: Switches back to 0.5 ImageTransparency and the Song Resumes
I’ll give it a shot, I guess it doesn’t help because the way I have these buttons set up is that they’re already at 0.5 until you hover over them and then the transparency gets set to 0, but the behavior im seeing on the other ways its been arranged is that it doesn’t actually toggle
MusicStop.MouseButton1Down:Connect(function()
print("Fired")
if MusicStop.ImageTransparency == 0 then
MusicStop.ImageTransparency = 0.5
SoundPlayer:Resume(); raiseSound:Play()
print("Resuming")
elseif
MusicStop.ImageTransparency == 0.5 then
MusicStop.ImageTransparency = 0
dimSound:Play(); dimSound.Completed:Wait()
SoundPlayer:Pause()
print("Pausing")
end
end)
I had to disable my other script where whenever you hovered your mouse over the button it would highlight, and it was messing with the behavior of the buttons themselves.