Changing Color Of A Point Light

Hi Fellow Players I Have A Problem With Changing colors on point light here’s my script i need a script for my problem and thanks for help - Abhay216

local clickdetector = script.Parent:WaitForChild(“ClickDetector”)

clickdetector.MouseClick:Connect(function(player)

game.Workspace.LightA.Pointlight = Color3.new(“GGA brown”)

end)

Pointlight.Color =

30 charrrrrr

Also GGA brown isnt a Color3 Value

I’d really recommend looking at the API reference in the future.

@waterrunner To add on to this, setting a PointLight’s Color value to a BrickColor will lead to an error as it’s expecting a Color3 value. Luckily, BrickColors have a .Color property so you can just use that to get the Color3 value.

local clickdetector = script.Parent:WaitForChild(“ClickDetector”)

clickdetector.MouseClick:Connect(function(player)
    game.Workspace.LightA.Pointlight.Color = BrickColor.new("CGA brown").Color
end)
1 Like

@UsernameMissingOrNil
Thanks for picking me up on this. I have deleted my previous reply to avoid spreading misconceptions and broken code.


The reason why your script ins’t working is because you are attempting to pass a string into color3.new() when it only accepts numbers. A simple fix would be to do Color3.fromRGB() and pass the R, G, B value of the color you want.

Here is your code fixed:

local clickdetector = script.Parent:WaitForChild("ClickDetector")

clickdetector.MouseClick:Connect(function(player)
	game.Workspace.LightA.Pointlight.Color = Color3.fromRGB(0,0,0) -- Change this to the color you want
end)
10 Likes

Thanks :smiley:

30 charrrrrrrrrrrrrr

local click = script.Parent.ClickDetector

click.MouseClick:Connect(function(player))
workspace.LightA.PointLight.Color = Color3.new(“GGA brown”)
end)