As thumb rule you can say that you can make everything. Some things are technically impossible and some things are possible but will overwhelm CPU resources.
That's absolutely not the case in this. Basically, you have rocks, which you could say are several doors which you are sliding to the right. This is very objective though as I don't really know what to "right" is, it depends on your viewpoint.
I would create it as this:
function drag(doors)
for i = 1,30 do
for i, rock in pairs(doors) do
rock.CFrame = rock.CFrame * CFrame.new(0,0,0.2)
end
wait()
end
wait(5)
for i = 1,30 do
for i,rock in pairs(doors) do
rock.CFrame = rock.CFrame * CFrame.new(0,0,-0.2)
end
end
end
local doors = {}
table.insert(doors, game.Workspace.Rock1)
table.insert(doors, game.Workspace.Rock2)
drag(doors)
You will notice however that the doors are sliding to the left, or in the wall, or from it. You need to either change the CFrames to one of the following:
CFrame.new(0,0,-0.2) and CFrame.new(0,0,0.2)
or
CFrame.new(0.2,0,0) and CFrame.new(-0.2,0,0)
or
CFrame.new(-0.2, 0, 0) and CFrame.new(0.2,0,0)
5 comments
How do I make it so that when I click a button it moves?
Call drag(doors) when the button is clicked, thus ClickDetector.MouseClick:connect(function() drag(doors) end)
I tried making the doors and it didn't work, I put the doors I wanted in a group named 'Doors' and made changes to the script: table.insert(doors, game.Workspace.Doors.Rock1)
try doors = game.Workspace.Doors:GetChildren() - remove every "table.insert" line.
Still doesn't work.