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

How Do I make a Gate Go Up And Down?

Asked by 10 years ago

Please include the code which you are trying to use, so the community will be better-equipped to help you with your problem.

Ive Tryed 2 Times Neither have worked also i have only made 1 script before so Dont Judge.

3 answers

Log in to vote
1
Answered by
Dominical 215 Moderation Voter
10 years ago

You need to know a little bit of scripting but here it is:

gate = workspace.Gate -- GATE GOES HERE

repeat
 gate.CFrame = gate.CFrame+Vector3.new(0,1,0)
until gate.Position.Y == 2 --PUT THE Y POS YOU WANT IT TO GO HERE

To learn more about CFrame go here: http://wiki.roblox.com/index.php?title=CFrame To learn more about repeat loops and other loops go here: http://wiki.roblox.com/index.php?title=Loops

Ad
Log in to vote
0
Answered by
daricr 0
10 years ago

Well, you possibly want to use a free model if your a starter or possibly just use the X,Y,&Z.

Log in to vote
0
Answered by 10 years ago

I do this all the time for railroad crossings. You'll want to have a motor part at the rear end of the gate that will move it up and down, the motor must be attached to something on each side of it using a joint. Insert a BodyAngularVelocity into the motor part. Now you need to change the angularvelocity and maxTorque values to make it strong enough to life your gate. (Counterweights can be used for more experienced people, who could also use a Cframe script instead of BodyAngularVelocity.) Now you just need a script to change the BodyAngularVelocity's angularvelocity value. It may look something like this:

script.Parent.Motor.BodyAngularVelocity.angularvelocity = Vector3.new(0,0,-1.5)

You'll have to play around with the X Y and Z values in the BodyAngularVelocity to get it to work in the right direction. (No use having the wrong numbers in making it try to go sideways.) It's not that hard after you do it a few times, but expect a bit of trial and error if this is your first time making a gate. Once you get the hang of it, try to make a gate using Cframing instead of the motor. Contact me via Email [email protected] if you want me to show you some of my examples, or need more help.

Answer this question