You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to be able to clone the SurfaceLights from these parts into the other parts with the same model name.
What is the issue? Include screenshots / videos if possible!
I have over 100…that I’d have to manually add surfacelight too and edit the surfacelight property…
You seem to have three models with the name “Model” on the same hierarchy level (under one model called “Model”, which is under the “Traffic Light” model). Do they contain different things?
Select the Traffic light model that contains the surface lights in the explorer. Then run this code in the command bar.
local mainTrafficLight = game:GetService("Selection"):Get()[1] -- the one that contains the surface lights
local gLight, rLight, yLight
for i, v in ipairs(mainTrafficLight.Model:GetChildren()) do
local setA = v:FindFirstChild("Traffic Light - set A")
if setA then
print("set A found in main traffic light")
gLight, rLight, yLight = setA.G:FindFirstChildOfClass("SurfaceLight"), setA.R:FindFirstChildOfClass("SurfaceLight"), setA.Y:FindFirstChildOfClass("SurfaceLight")
if gLight and rLight and yLight then
break
end
end
end
print(gLight, rLight, yLight)
for i, v in ipairs(workspace:GetChildren()) do
if v.Name == "Traffic Light" and v ~= mainTrafficLight then
print ("Found a traffic light model")
for i, model in ipairs(v.Model:GetChildren()) do
local setA = model:FindFirstChild("Traffic Light - set A")
if setA then
print("set A found")
rLight:Clone().Parent, gLight:Clone().Parent, yLight:Clone().Parent = setA.R, setA.G, setA.Y
end
end
end
end
14:46:36.655 SurfaceLight is not a valid member of Part "Workspace.Traffic Light.Model.Model.Traffic Light - set A.G" - Edit
14:46:36.655 Stack Begin - Studio
14:46:36.656 Script 'local mainTrafficLight = game:GetService("Selection"):Get()[1]
local gLight, rLight, yLight
for i, v in ipairs(mainTrafficLight.Model:GetChildren()) do
local setA = v:FindFirstChild("Traffic Light - set A")
if setA then
gLight, rLight, yLi', Line 6 - Studio
14:46:36.656 Stack End - Studio