Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there a way to change properties of multiple objects with Arrays?

Hey all, I'm tired of changing a property of multiple objects one by one, but when I tried to make an array to solve this it did not work. How could I have this so all of these could be changed with a table, I do not know where to begin.

local player = game.Players.LocalPlayer
local x = 5


game.ReplicatedStorage.SeeThrough.OnClientEvent:Connect(function(seat)
print(seat.name)
	if seat.Occupant ~= nil then
		seat.Parent.Parts.Part1.Transparency = 0.5
		seat.Parent.Parts.Part2.Transparency = 0.5
		seat.Parent.Parts.Part3.Transparency = 0.5
		seat.Parent.Parts.Part4.Transparency = 0.5
			else
		seat.Parent.Parts.Part1.Transparency = 0
		seat.Parent.Parts.Part2.Transparency = 0
		seat.Parent.Parts.Part3.Transparency = 0
		seat.Parent.Parts.Part4.Transparency = 0
	end
end)

1 answer

✓ Accepted answer

do you mean something like this?

Array = {Object1,Object2,Object3,Object4}
for i = 1, #Array do
	Array[i].Transparency = 0
end

This discussion is preserved as it was. New answers, comments, and votes are closed.