@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()
01 | local p = script.Parent.Parent:GetChildren() |
03 | if p.Name = = "Cylinder" then |
04 | if p.Transparency = = 0 and p.CanCollide = = false then |
07 | elseif p.Transparency = = 1 and p.CanCollide = = true then |
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)