So I am trying to redo this script for a gui, and I wanted to add this feature where if you toggle the button it changes color. In this scenario, I wanted to specifically do; when its off, its (30,30,31) and when its on, its (255,0,0). However, I came into contact with this problem that after turning it off, the color is then brighter than the original. Heres the script:
local P = script.Parent.Parent.Parent.Parent.Parent.Name
local HLoc = game.Workspace:FindFirstChild(P)
HighVis = script.Parent.Parent.Parent.HighVis
LowVis = script.Parent.Parent.Parent.LowVis
function onClick(mouse)
local Helmet = HLoc:findFirstChild("Face")
if Helmet ~= nil and HighVis.Value==false and LowVis.Value==false then
Helmet.Light.Bright.Enabled = true
Helmet.glass.Transparency = 0
Helmet.Light2.light.Enabled = true
script.Parent.BackgroundColor3 = Color3.new(255,0,0)
HighVis.Value = true
elseif Helmet ~= nil and HighVis.Value==true and LowVis.Value==false then
Helmet.Light.Bright.Enabled = false
Helmet.glass.Transparency = 1
Helmet.Light2.light.Enabled = false
script.Parent.BackgroundColor3 = Color3.new(10,10,11)
HighVis.Value = false
end
end
script.Parent.MouseButton1Down:connect(onClick)
