Mute button doesn't work

So, I’ve been working on a game lately, and in my game I added a mute button. But for some reason, when I went into the game, I got an error message saying, Volume is not a valid member of Model. Annotation 2020-08-19 042440
Oh and here’s the code for the mute button that I always use for the mute button:

local music = game.Workspace.Sunscreen

script.Parent.MouseButton1Click:Connect(function()
	if music.Volume == 0.5 then
		music.Volume = 0
	end
end)

Please help. Because I have no idea about what is going on, because I always use this code for my mute buttons.

Thanks.

2 Likes

You probably have Sunscreen named over two times in workspace. Change it to something unique. OR you have it under game.Workspace.Sunscreen.

3 Likes

Oh yeah. I see now.
Annotation 2020-08-19 043341
Sorry, I’m pretty new to scripting. But thanks anyways!

1 Like