Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Clone lights into parts help?

Asked by
NotSoNorm 777 Moderation Voter
9 years ago

Ok so like I have a clone pointlight and I want to clone it and put it in everyblock but idkdkkdkd

local Lights = game.Workspace.Flashies:GetChildren()

for i = 1, #Lights do
    local AddLight = Lights.Clone.PointLight:Clone()
    AddLight.Parent = Lights[i]
    wait(1)
end
0
when you say every part, do you mean every part in the Flashies model or every part in the game? aquathorn321 858 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

Little confused by your question, but if you want the light to be cloned into every part named something or other, this script is for you!

p = game.Workspace:getChildren()
for i=1, #p do
    if p[i].Name == "Part" then
        light = game.Workspace.Flashies:Clone()
        light.Parent = p[i]
        light.Name = "Light"
    end
end

change the "Part" to whatever part name you want and it will add the light to every said part.

Ad
Log in to vote
0
Answered by 9 years ago
local Lights = game.Workspace.Flashies:GetChildren()

for i ,v in pairs(Flashies) do
    local AddLight = Lights.Clone.PointLight:Clone()
    AddLight.Parent = v
    wait(1)
end

If you have any mistakes in your script, it would be in line 4. the script looks fine to me, but maybe you're making the wrong reference to an object. could you post an error so I know what's wrong?

Answer this question