Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a brick move?

Asked by 9 years ago

So, if I wanted to make a brick move 4 studs on the z axis. I would be doing this for a sliding door. So basically, I'm saying: How do I make a sliding door?

1 answer

Log in to vote
1
Answered by
Bman8765 270 Moderation Voter
9 years ago

Because this is not a request site and it appears like you are making a request I will try to answer this in a limited yet informative way. I want you to understand and learn how to do this instead of me completing it for you. There are 2 ways you could move this brick, that is CFrame ( ) or you can use Vector3 ( ). Vector3 allows you to change the position property of an item. For example:

part.Position = Vector3.new(movex, movey, movez)

CFrame has it's own properties which means you would have to use the brick's CFrame to change these. For Exampe:

Part.CFrame = CFrame.new(movex, movey, movez)

Now just to explain that to you, movex is nothing (nil) It is just there purely for an example of how to do it. Now you could have a variable named movex otherwise you could just place a number there. I wont get into rotations but that's on the wiki link I posted too. Now if you want to make it "slide" you could simply use a for statement ( ) Example:

for move1 = 1, 4 do
    part.Position = part.Position + Vector3.new(0, 0, 1)
    wait()
end

This will then loop everything in between do and end 4 times! You can now mess around with the given information to create a sliding door. Everything I have told you is beneficial for creating the door and if you put 2 and 2 together you should be able to accomplish it! If you need any more info simply go to google.com and search Vector3 roblox or CFrame roblox!

Ad

Answer this question