Answered by
5 years ago Edited 5 years ago
I assume your explorer looks something like this.
Insert a part into the workspace, and insert a ClickDetector inside of that part.
Create a Script inside of ServerScriptService:
01 | local Part = game.Workspace:WaitForChild( "Part" ) |
02 | local ClickDetector = Part:WaitForChild( "ClickDetector" ) |
04 | ClickDetector.MouseClick:Connect( function () |
05 | for i, v in pairs (game.Workspace.Lights:GetChildren()) do |
06 | local R = math.random( 255 ) |
07 | local G = math.random( 255 ) |
08 | local B = math.random( 255 ) |
09 | v.SpotLight.Color = Color 3. fromRGB(R, G, B) |
So, whenever someone clicks on the part you created, it'll loop through the entire model that contains the parts, and on each iteration, it'll change the SpotLight inside of each part so that they are a different color.
In this example, it just randomizes the color, but you can remove the three variables and the assignment of the SpotLight's color if you want to do something else.