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

How to gather parts and change properties all at once??

I forgot. Halp. Please. For the love of almighty Jesus.

To be more specific, I have a gate that needs all the objects within named "Cylinder" to become transparent and non-colliding.

2 comments

0

A note, you can't technically do two things at "once." Perhaps if you have a quantum computer. ;)

0

But even then , quantum computers will never be able to process as much data as a game needs to for the next millennium or two.

2 answers

Next time provide proof that you even tried to make the script

model = game.Workspace.Gate:GetChildren() -- lets say that Gate is the name of your model

for i = 1,#model do
if model[i].Name = "Cylinder" then
model[i].Transparency = 1
model[i].CanCollide = false -- could be true, you choose
end

@1st answer Sorry, I was desperate, it was 4AM, and I was being a little lazy xD Here was the original script

script.Parent.Lever.ClickDetector.MouseClick:connect(function()

local p = script.Parent.Parent:GetChildren()
for i = 1,#p do
	if p.Name == "Cylinder" then
		if p.Transparency == 0 and p.CanCollide == false then
			p.Transparency = 1
			p.CanCollide = true
		elseif p.Transparency == 1 and p.CanCollide == true then
			p.Transparency = 0
			p.CanCollide = false
		end
	end
end

end)

EDIT: Anyone curious out there, I finalized the script. Thanks @First Answer

local ooc = script.Parent.OpenOrClosed --checks if the gate is open/closed --false = closed, true = open, its a boolean value.

script.Parent.Lever.ClickDetector.MouseClick:connect(function() local model = game.Workspace.Gate:GetChildren() for i = 1,#model do if model[i].Name == "Cylinder" and ooc == false then model[i].Transparency = 1 model[i].CanCollide = false ooc = true else model[i].Transparency = 0 model[i].CanCollide = true ooc = false end end end)

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