I suppose its something to do with the beam. So basically there's a GUI that controls the Lighting System, and once you click on that GUI, another GUI pops up and lets you type in the respective Red, Green and Blue values. Now, the system works, but every time I try to enter different values, the light changes to the default value (0,0,0 black). Is there anything wrong?
local r = script.Parent:WaitForChild("R") local rvalue = r.Text local g = script.Parent:WaitForChild("G") local gvalue = g.Text local b = script.Parent:WaitForChild("B") local bvalue = b.Text local ent = script.Parent:WaitForChild("ent") function UpdateColor() local system = workspace["Airbus A320 by FlightPlan (PAID)"]:FindFirstChild("LightSystem") local part2 = system.LightPart2 local part = system.LightPart local beam = part.Beam local light = part.SurfaceLight local color1 = Color3.fromRGB(rvalue,gvalue,bvalue) local color2 = Color3.fromRGB(rvalue,gvalue,bvalue) part.Color = Color3.fromRGB(rvalue,gvalue,bvalue) part2.Color = Color3.fromRGB(rvalue,gvalue,bvalue) beam.Color = ColorSequence.new(color1,color2) light.Color = Color3.fromRGB(rvalue,gvalue,bvalue) script.Parent.Parent:Destroy() end ent.MouseButton1Click:Connect(UpdateColor)
Answers are appreciated!
EDIT: Answered by kingdom5
function UpdateColor() local r = script.Parent:WaitForChild("R") local rvalue = tonumber(r.Text) local g = script.Parent:WaitForChild("G") local gvalue = tonumber(g.Text) local b = script.Parent:WaitForChild("B") local bvalue = tonumber(b.Text) local ent = script.Parent:WaitForChild("ent") local system = workspace["Airbus A320 by FlightPlan (PAID)"]:FindFirstChild("LightSystem") local part2 = system.LightPart2 local part = system.LightPart local beam = part.Beam local light = part.SurfaceLight local color1 = Color3.fromRGB(rvalue,gvalue,bvalue) local color2 = Color3.fromRGB(rvalue,gvalue,bvalue) part.Color = Color3.fromRGB(rvalue,gvalue,bvalue) part2.Color = Color3.fromRGB(rvalue,gvalue,bvalue) beam.Color = ColorSequence.new(color1,color2) light.Color = Color3.fromRGB(rvalue,gvalue,bvalue) script.Parent.Parent:Destroy() end script.Parent.ent.MouseButton1Click:Connect(UpdateColor)