Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I select pointlights that have a specific color?

Kinda stuck on this. Trying to use the Command Bar to select all pointlights with the color "Really blue". Anything helps.

local Lights = {}

function getLights(root)
	for i,v in pairs(root:GetChildren()) do
		if v:IsA("PointLight") and v.Color3 == ("0, 0, 255") then
			table.insert(Lights,v)
		end
		getLights(v)
	end
end

getLights(workspace)

game.Selection:Set(Lights)

1 answer

Hello T1_Backyard! I'm here to help you.

To make this script, you can use Color3.FromRGB.

Just a mistake, don't add 3 to v.Color

local Lights = {}

function getLights(root)
    for i,v in pairs(root:GetChildren()) do
        if v:IsA("PointLight") and v.Color == Color3.fromRGB(0, 0, 255) then
            table.insert(Lights,v)
        end
        getLights(v)
    end
end

getLights(workspace)

game:GetService("Selection"):Set(Lights)

It's just that! Accepte anwser or modifie your title to add [SOLVED].

This discussion is preserved as it was. New answers, comments, and votes are closed.