I have a script that detects key presses within a Frame, because of the nature of the game the key input can be either right or wrong, so, therefore, I change the background color of the GUI element to let the user know if the answer he submitted (through keypresses) was correct or not. Then I set the GUI element attribute "Visible" to false and change the color back to the original [48,48,48] in readiness for the next GUI element, however, the next time that same GUI element appears, the color looks like [255,255,255] but observing the value shows me some ridiculously high numbers in the tens of thousands.
I'm not sure why it is happening, so here's my code:
local user_input = game:GetService("UserInputService")
local picked = false
user_input.InputBegan:Connect(function(key_input)
if key_input.KeyCode == Enum.KeyCode.F and picked == false and script.Parent.Visible == true then
picked = true
script.Parent.BackgroundColor3 = Color3.new(0,225,0)
wait(2)
game.ReplicatedStorage.OptionPicked:FireServer(true)
script.Parent.Visible = false
script.Parent.BackgroundColor3 = Color3.new(48,48,48)
elseif key_input.KeyCode == Enum.KeyCode.G and picked == false and script.Parent.Visible == true then
picked = true
script.Parent.BackgroundColor3 = Color3.new(255,0,0)
wait(2)
game.ReplicatedStorage.OptionPicked:FireServer(true)
script.Parent.Visible = false
script.Parent.BackgroundColor3 = Color3.new(48,48,48)
end
end)
Here is the picture of the BackgroundColor3 value before and after:
Before key was pressed (Original color): https://gyazo.com/bc0902afe740f86cf562def153af12fb
During key was pressed (Appears as [0,255,0]): https://gyazo.com/aeb13a75c151faeb76798dc3aff66950
After key was pressed (Appears as [255,255,255]): https://gyazo.com/12230b9a03afa91aca9017d97b1840a9
