Hello, how do i make a settings system?
1 Like
Can I please have more information? Start by making a ScreenGui with a Frame.
All I’m wondering is how do I make it so the player can enable and disable the setting, the script I made didn’t work.
My Script:
local State = true
local ColorChange = script.Parent.Parent
local Button = script.Parent
Button.MouseButton1Click:Connect(function()
if not State.Value then
ColorChange.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
ColorChange.SettingState.Text = "Off"
State = false
else
ColorChange.BackgroundColor3 = Color3.fromRGB(34, 252, 78)
ColorChange.SettingState.Text = "On"
State = true
end
end)
local State = true
local ColorChange = script.Parent.Parent
local Button = script.Parent
Button.MouseButton1Click:Connect(function()
if State.Value == true then
ColorChange.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
ColorChange.SettingState.Text = "Off"
State = false
else
ColorChange.BackgroundColor3 = Color3.fromRGB(34, 252, 78)
ColorChange.SettingState.Text = "On"
State = true
end
end)
It still won’t work, I don’t get any errors either
is it a local script???
Yes, Dose it need to be a server script?
No, and can I see your explorer along with properties?
Here it is:
local State = true
local ColorChange = script.Parent.Parent
local Button = script.Parent
Button.MouseButton1Click:Connect(function()
if State.Value == true then
ColorChange.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
ColorChange.Toggle.SettingState.Text = "Off"
State = false
else
ColorChange.BackgroundColor3 = Color3.fromRGB(34, 252, 78)
ColorChange.Toggle.SettingState.Text = "On"
State = true
end
end)
Sadly, it still won’t work. I dont know whats happening
I see the problem, you don’t need to clarify the value for globals:
local State = true
local ColorChange = script.Parent.Parent
local Button = script.Parent
Button.MouseButton1Click:Connect(function()
if State == true then
ColorChange.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
ColorChange.Toggle.SettingState.Text = "Off"
State = false
else
ColorChange.BackgroundColor3 = Color3.fromRGB(34, 252, 78)
ColorChange.Toggle.SettingState.Text = "On"
State = true
end
end)
Unless you forgot to add value to them.
It works now, but the text wont change, and after i turn the setting off it wont turn back on