I have 5 identical screens that have individual controls for moving them up and down.
But I like to have a “master” button that moves all of them at the same time.
door = script.Parent
door1 = door.DoorModel:GetChildren()
button = door.liftboard.SurfaceGui.up
val = door.Value
poop = door.DoorModel
button.MouseButton1Click:connect(function()
val.Value = val.Value + 1
if (val.Value>1000) then
val.Value = val.Value - 1
return
end
if (val.Value <= 1000) then
for i=1, 100 do
for j=1, #door1 do
poop:SetPrimaryPartCFrame(poop:GetPrimaryPartCFrame() * CFrame.new(0,.020,0))
end
wait()
end
end
end)
you could loop through all the LiftX with something like
for _, lift in Screens:GetChildren() do
DoWhatever(life.DoorModel) -- here you would run your code for moving it up
end
Also, unrelated but instead of doing many small :SetPrimaryPartCFrame()s you could look at TweenService
(And even :SetPrimaryPartCFrame() has been superseded by :PivotTo() see Model)
what have you tried? maybe try taking the code you have and changing it so you have a function that will move any door up, the only way to be a “good” scripter is to keep trying stuff out
The code in my other post has a function DoWhatever() which is just a placeholder for your code to lift some door up, you should try modifying your code to fit that and post any more code you have
Where should I like up this to make sense in this script?
door = script.Parent
door1 = door.DoorModel:GetChildren()
button = door.liftboard.SurfaceGui.up
val = door.Value
poop = door.DoorModel
button.MouseButton1Click:connect(function()
val.Value = val.Value + 1
if (val.Value>1000) then
val.Value = val.Value - 1
return
end
if (val.Value <= 1000) then
for i=1, 100 do
for j=1, #door1 do
poop:SetPrimaryPartCFrame(poop:GetPrimaryPartCFrame() * CFrame.new(0,.020,0)) -- I presume this is the code that moves the screen up
end
wait()
end
end
end)
Note that this is not my written script and this came with a model that I used to make my screens, so I don’t 100% understand this.