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.
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)