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

Is There a Way to Make Changes in Your Game Permanent Through Scripting?

Asked by 4 years ago
Edited 4 years ago

Like lets say I have multiple parts, green, in my game and I wanted to change them all to white. It would take me forever to click through all my models and change the parts manually. Is it possible for me to make a script to go through every part and change the color automatically?

1 answer

Log in to vote
1
Answered by
DanzLua 2879 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

Use a for loop in the command bar

for _,v in pairs(model:GetChildren()) do
    v.Color=Color3.fromRGB(255,255,255)
end

If you can't find it click on the views tab of studio and click on command bar

Edit: To get all descendants of the model

for _,v in pairs(model:GetDescendants()) do
    if v:IsA("BasePart") then
        v.Color=Color3.fromRGB(255,255,255)
    end
end
0
That would work if the children didn't have children themselves, I need a recursive function to change the colors of the children if the part has any Retr0Thief 104 — 4y
0
@xXCyberProXx edited answer DanzLua 2879 — 4y
0
Ah, Thank you! Retr0Thief 104 — 4y
Ad

Answer this question