Leg0brick
|
  |
| Joined: 24 Jul 2012 |
| Total Posts: 651 |
|
|
| 10 Apr 2016 10:21 PM |
I am trying to make a part move while someone is pressing a key, but I'm not sure what type of BodyMover I should use to achieve this. Or how to use it. Any help is appreciated.
#code while wait() do print("ServerStorage > Lighting") end |
|
|
| Report Abuse |
|
|
Leg0brick
|
  |
| Joined: 24 Jul 2012 |
| Total Posts: 651 |
|
|
| 10 Apr 2016 10:27 PM |
bump
#code while wait() do print("ServerStorage > Lighting") end |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2016 10:32 PM |
It really depends on what you want to use it for. Any kind of BodyMover outside of BodyGyro and BodyAngularVelocity could move it. It really depends on what would be easier and your approach.
BodyVelocity tries to set a permanent velocity to the part (Gravity still happens, but nowhere near as much)
BodyForce sets a constant acceleration to the part in world space.
BodyThrust sets a constant acceleration to the part in local space.
BodyPosition tries to get the part to fly to and stay at the specified position.
RocketPropulsion tries to get a part to fly towards another.
|
|
|
| Report Abuse |
|
|
Leg0brick
|
  |
| Joined: 24 Jul 2012 |
| Total Posts: 651 |
|
|
| 10 Apr 2016 10:59 PM |
Imagine a one brick car. If I press w it moves forward, if I press s it moves backwards, etc...
#code while wait() do print("ServerStorage > Lighting") end |
|
|
| Report Abuse |
|
|
| |
|
Leg0brick
|
  |
| Joined: 24 Jul 2012 |
| Total Posts: 651 |
|
|
| 10 Apr 2016 11:39 PM |
Alright, this is what I have. But it's not functioning at all. It prints 1 but doesn't move. Please note that this is my first time working with any type of bodymover...
function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.W then print(1) Instance.new("BodyThrust",bot) bot.BodyThrust.Force = Vector3.new(0,100,0) end end game:GetService("UserInputService").InputBegan:connect(onKeyPress)
#code while wait() do print("ServerStorage > Lighting") end |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2016 11:41 PM |
Just a side note:
if inputObject.KeyCode == Enum.KeyCode.W and not gameProcessedEvent then -- It stops it going off when you type in chat.
|
|
|
| Report Abuse |
|
|
Leg0brick
|
  |
| Joined: 24 Jul 2012 |
| Total Posts: 651 |
|
|
| 11 Apr 2016 12:56 AM |
b
#code while wait() do print("ServerStorage > Lighting") end |
|
|
| Report Abuse |
|
|