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

How can i change properties of multiple parts at once in a script?

Asked by 2 years ago

Hello, I am currently working on making the ground parts in ma game change transparency but instead of doing part1, part2 , part3 I want to select them at once. I tried looking for the answer but it only changes to property of certain parts. I also dont understand the "i" in the loop. please help

local GroundParts = script.Parent.GroundParts -- my folder
local partsFolder = GroundParts:GetChildren() -- getting the parts



while true do
    for i, parts in pairs(partsFolder) do
            parts.Transparency = 1

            wait(15) -- 360 seconds -- 6 minutes
        end
    end 

2 answers

Log in to vote
0
Answered by
MattVSNNL 620 Moderation Voter
2 years ago

I found your reason, You put the wait after you set it so it waits 15 seconds between changing them!

Here's a new script:

local GroundParts = script.Parent.GroundParts -- my folder
local partsFolder = GroundParts:GetChildren() -- getting the parts

while true do

    for i, parts in pairs(partsFolder) do
        parts.Transparency = 1
    end

    wait(15)

end 
0
Thank you! 123marooxd123 13 — 2y
0
No problem MattVSNNL 620 — 2y
Ad
Log in to vote
0
Answered by
enes223 327 Moderation Voter
2 years ago

hey you! have you ever heard of enes? if you are in trouble, better call enes!

Answer this question