ShockTech
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 40 |
|
|
| 09 Nov 2011 10:52 PM |
I'm basically a scripting noob. Not much experience. I whipped this up:
car = Workspace.Elevator.Car f2 = Workspace.Elevator.Floor2
function GoToFloor2() local b = Instance.new("BodyPosition") b.position = Vector3.new(car.Position.X, f2.Position.Y, car.Position.Z) b.maxForce = Vector3.new(5000, 5000, 5000) b.Parent = car wait(5) b.Parent = nil end
script.Parent.MouseClick:connect(GoToFloor2)
"Elevator" is the model they're all inside. "Car" is the brick I'm using as the elevator. "Floor2" is the nonCanCollide anchored brick I'm using to mark floor 2.
It gives no error in the output, but the "car" doesn't move when the BodyPosition is put inside of it by the script. In fact, it doesn't do anything. Please help me end this headache. |
|
|
| Report Abuse |
|
|
|
| 09 Nov 2011 10:54 PM |
first of all, is 'car' a part? if not, i think you have to put the bodyposition inside a part.
second, id try making the maxforce higher. try like 100 thousand or something. also, to make it a little slower, make the bodyposition.D = like 100 or something like that |
|
|
| Report Abuse |
|
|
ShockTech
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 40 |
|
|
| 09 Nov 2011 10:58 PM |
| Car IS a part, yes. I'll try your suggestion now. |
|
|
| Report Abuse |
|
|
ShockTech
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 40 |
|
|
| 09 Nov 2011 11:10 PM |
Okay, I did what you suggested. ...And it ALMOST works.
The elevator moves now, but it shoots up, and hovers up and down, slowly concentrating on the right y-coordinate. Imagine a person bungee jumping, but backwards. |
|
|
| Report Abuse |
|
|
|
| 09 Nov 2011 11:11 PM |
1. set the D a LOT higher 2. set the maxforce a lot lower
the maxforce needs to be pretty high in order to actually move the thing, but if its too high, it will result in what you said happening. having the D set really high should stop it, but you will want to lower the maxforce as well. |
|
|
| Report Abuse |
|
|
ShockTech
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 40 |
|
|
| 09 Nov 2011 11:16 PM |
| A'ight. Set the D to 1000, set the maxForce to 10,000. Trying that now. Will lower the maxForce if it doesn't work. |
|
|
| Report Abuse |
|
|
ShockTech
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 40 |
|
|
| 09 Nov 2011 11:21 PM |
It works a lot better now. Thank you very much. Now this might be pushing it, but I'd like to make it so it can't be moved, except by the script. Like it's anchored. That sounds more like CFraming, but I've heard CFrame elevators don't work. How would I go about doing this? Would I have to change the script completely? |
|
|
| Report Abuse |
|
|
|
| 09 Nov 2011 11:25 PM |
| what i would do is just what you said - anchor it, at least when it isnt supposed to move. so before you insert the bodyposition to move it, un anchor it, then when you remove the bodyposition, anchor it again so it will stop moving. |
|
|
| Report Abuse |
|
|
ShockTech
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 40 |
|
|
| 09 Nov 2011 11:28 PM |
The problem with that is you could move it while it was going up. Unless... Unless I set the x and z destination to be that of floor 2, as well? Or would it still be movable? Hm. I will test this, and reply with the results. |
|
|
| Report Abuse |
|
|
ShockTech
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 40 |
|
|
| 09 Nov 2011 11:35 PM |
| Alright, back. I did what I mentioned, and it works even better. But now when you stand on it while it's moving up, and rotates and spins due to your weight. Is there an object I could insert into it to make it keep it's orientation, no matter what? |
|
|
| Report Abuse |
|
|
|
| 09 Nov 2011 11:43 PM |
yes, you can use a bodygyro
all you have to do is set the maxtorque really high, it will hold it at the rotation that its currently at |
|
|
| Report Abuse |
|
|
ShockTech
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 40 |
|
| |
|
ShockTech
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 40 |
|
|
| 09 Nov 2011 11:58 PM |
It works beautifully. From the bottom of my plastic, Robloxian heart, I thank you sir. If ever I have a problem I cannot figure out, I shall turn to you for wisdom. *cheesy bow* |
|
|
| Report Abuse |
|
|
ShockTech
|
  |
| Joined: 07 Mar 2009 |
| Total Posts: 40 |
|
|
| 10 Nov 2011 12:09 AM |
No, that wasn't sarcasm. Seriously man, thanks. |
|
|
| Report Abuse |
|
|