I'm trying to make a door which, when a button is pressed, slides to the right. But it's sort of different to that. I want my door to be like this:
When a button is pressed, several rocks move to the right, uncovering a secret tunnel. Is it possible to do this? If so, help me out! :)
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) -- and so on -- an event happens: 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)