I'm making a menu with a textbox, where it modifies the volume of music played by a player, and a separate one for sound effects. I know what might be wrong, I just don't know how to fix it. Here is the script:
--variables
local DarkModeButton = script.Parent.DarkModeButton
local SettingsMenuFrame = script.Parent
local BlueModeButton = script.Parent.BlueModeButton
local LightModeButton = script.Parent.LightModeButton
local CloseButton = script.Parent.CloseSettingsButton
local SoundEffect = script.Parent.Parent.Sounds
local UserInputService = game:GetService("UserInputService")
local VolumeBox = script.Parent.MusicVolumeBox
local Music = game.ReplicatedStorage.Music
--functions
VolumeBox:GetPropertyChangedSignal("Text"):Connect(function()
if VolumeBox.Text == "0" then--set value to zero. I tried it and it doesn't work. I also tried the enum.keycode thing but it doesn't work either
for i,v in pairs(Music:GetChildren()) do
if v.ClassName == "Sound" then
Music:GetChildren().Volume = 0
end
end)
DarkModeButton.MouseButton1Click:Connect(function()
SettingsMenuFrame.BackgroundColor3 = Color3.new(0, 0, 0)
for i,v in pairs(script.Parent:GetChildren()) do
if v.ClassName == "TextButton" or "TextLabel" then
Color3.new(1,1,1)
end
end
end)
LightModeButton.MouseButton1Click:Connect(function()
SettingsMenuFrame.BackgroundColor3 = Color3.new(1,1,1)
for i,v in pairs(script.Parent:GetChildren()) do
if v.ClassName == "TextButton" or "TextLabel" then
Color3.new(0,0,0)
end
end
end)
BlueModeButton.MouseButton1Click:Connect(function()
SettingsMenuFrame.BackgroundColor3 = Color3.new(0,0,1)
for i,v in pairs(script.Parent:GetChildren()) do
if v.ClassName == "TextButton" or "TextLabel" then
Color3.new(0,0,0)
end
end
end)
CloseButton.MouseButton1Click:Connect(function()
SettingsMenuFrame:TweenPosition(
UDim2.new(0.25,0,-4,0),
"In",
"Linear",
1,
true
)
end)
for i,v in pairs(script.Parent:GetChildren()) do
if v.ClassName == "TextButton" then
v.MouseEnter:Connect(function()
SoundEffect.HoverSound:Play()
end)
end
end
for i,v in pairs(script.Parent:GetChildren()) do
if v.ClassName == "TextButton" then
v.MouseButton1Click:Connect(function()
SoundEffect.Click:Play()
end)
end
end
UserInputService.InputBegan:Connect(function(Input, gameProccessedEvent)
if Input.UserInputType == Enum.UserInputType.Keyboard then
if Input.KeyCode == Enum.KeyCode.S then
SettingsMenuFrame:TweenPosition(
UDim2.new(0.25,0,0.274,0),
"Out",
"Linear",
1,
true
)
end
end
end)
idk how to include screenshots pls help thanks
