Hi, I am newish to scripting and am currently trying to change multiple parts.BrickColor at the same time, within the same model. I have tried both a for loop and a while loop and while the for loop works but changes them independantly the while loop doesn’t work at all. Here are both samples of code I have used. Any help would be much appreciated.
local CollectionService = game:GetService("CollectionService")
local Tagged = CollectionService:GetTagged("weaponBlock")
repeat
for i, object in pairs(Tagged) do
if object and object.BrickColor then
object.BrickColor = BrickColor.new("Really red")
wait()
object.BrickColor = BrickColor.new("Bright blue")
wait()
object.BrickColor = BrickColor.new("New Yeller")
wait()
object.BrickColor = BrickColor.new("Bright green")
wait()
end
end
until script.Disabled == true
local CollectionService = game:GetService("CollectionService")
local Tagged = CollectionService:GetTagged("weaponBlock")
local object = Tagged
while script.Disabled == false do
if object and object.BrickColor then
object.BrickColor = BrickColor.new("Really red")
wait()
object.BrickColor = BrickColor.new("Bright blue")
wait()
object.BrickColor = BrickColor.new("New Yeller")
wait()
object.BrickColor = BrickColor.new("Bright green")
wait()
end
wait()
end
Again thank you for any help