This is a local script, inside of a button, the names of the buttons are all correct and it will print the "1" but nothing else, the volume is set right i dont know whats wrong...? (I want the audio to turn off once clicked) Could somebody fix this script:

local Player = game:GetService('Players').LocalPlayer
local PlayerGui = Player:WaitForChild('PlayerGui')
local music = PlayerGui.Menu.Sound2
PlayerGui.Menu.Main_Menu.Menu_Background.Play_Button.Button.MouseButton1Click:Connect(function()
  print ("1")
if music.Volume == 0.2 then
	print ("2")
	music.Volume = 0
	print ("3")
end
end)

3 comments

0

What exactly are you trying to do with this? Is the volume set to 0.2 (Exactly)? Do you get any errors when running it?

0

Is "Sound2" a TextBox?

0

Sound 2 is a audio, and yes the volume is exactly 0.2