th3oracle
|
  |
| Joined: 23 Feb 2013 |
| Total Posts: 448 |
|
|
| 15 Sep 2013 03:18 PM |
I need help with my plane. When you sit down in the chair it gives you a tool. I need help with the tool script. I'm not sure how to go about doing this. Here's what I have:
tool = script.Parent player = tool.Parent tool.Selected:connect(function(mouse) mouse.KeyDown:connect(function(key) if key:lower() == "y" then --Need help end mouse.MouseButton1Down:connect(function(click) --Need help end) end)
When you press Y you go forward. Do I put a BodyVelocity in all of the parts? I'm not sure what do do there. Also, when you click, I want the plane to turn in the direction of the click. You know what I mean. Can anyone help? |
|
|
| Report Abuse |
|
|
th3oracle
|
  |
| Joined: 23 Feb 2013 |
| Total Posts: 448 |
|
| |
|
th3oracle
|
  |
| Joined: 23 Feb 2013 |
| Total Posts: 448 |
|
| |
|
|
| 15 Sep 2013 05:02 PM |
I fergawt if mouse.Hit returns if it's not clicking anything so :x
bodygyro = thing mouse.MouseButton1Up:connect(function(click) bodygyro.cframe = CFrame.new(middlepart.Position,mouse.Origin.p) end)
Not sure about #1 |
|
|
| Report Abuse |
|
|
th3oracle
|
  |
| Joined: 23 Feb 2013 |
| Total Posts: 448 |
|
|
| 15 Sep 2013 05:26 PM |
I have no experience with this kind of stuff. Can you please explain?
"bodygyro = thing"
Do you mean:
bodygyro = Instance.new("BodyGyro")
? Also, please explain "middlepart". Is "middlepart" a variable to a brick in the center of the plane? |
|
|
| Report Abuse |
|
|
| |
|
th3oracle
|
  |
| Joined: 23 Feb 2013 |
| Total Posts: 448 |
|
| |
|
th3oracle
|
  |
| Joined: 23 Feb 2013 |
| Total Posts: 448 |
|
|
| 15 Sep 2013 05:31 PM |
| Where does the BodyGyro go? |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2013 05:36 PM |
| I'd say in the middle part so it doesn't look awkward when turning... |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2013 05:38 PM |
| KeyDown returns a lowercase key so no need for translation :P |
|
|
| Report Abuse |
|
|
th3oracle
|
  |
| Joined: 23 Feb 2013 |
| Total Posts: 448 |
|
|
| 15 Sep 2013 06:35 PM |
| I still need help with the moving forward part. |
|
|
| Report Abuse |
|
|
th3oracle
|
  |
| Joined: 23 Feb 2013 |
| Total Posts: 448 |
|
|
| 15 Sep 2013 08:47 PM |
| I really need help! I can't figure out how to make the plane move forward when I press Y. Should I put a BodyVelocity in all of the parts? |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2013 09:16 PM |
| no, just in the center part |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2013 09:17 PM |
I wouldn't say on ALL the parts. Maybe like bodygyro and in the middle.
Take into account, the weight of the whole thing.
weight = part:GetMass() * 192.6 --192.6 I think --use a for loop to get all the fatness
You'd then do something like this..
centerpiece = something bodyv = Instance.new("BodyVelocity",centerpiece) bodyv.velocity = centerpiece.CFrame.lookVector * 10 --change 10 to increase force (I guess)
|
|
|
| Report Abuse |
|
|
th3oracle
|
  |
| Joined: 23 Feb 2013 |
| Total Posts: 448 |
|
|
| 15 Sep 2013 10:11 PM |
Here's what I have:
tool = script.Parent tool.Selected:connect(function(mouse) char = tool.Parent player = char:FindFirstChild(char.Name) ship = player.Ship bodygyro = Instance.new("BodyGyro") center = ship.Center bodygyro.Parent = center
mouse.KeyDown:connect(function(key) if key:lower() == "y" then totalmass = 0 c = game.Workspace.Ship:GetChildren() for i = #c, 1, -1 do if c[i].className == "Part" or c[i].className == "Seat" then m = c[i]:GetMass() totalmass = totalmass + m end end local bv = Instance.new("BodyVelocity") bv.Parent = center bv.velocity = center.CFrame.lookVector * 50 + totalmass end mouse.MouseButton1Down:connect(function(click) bodygyro.cframe = CFrame.new(center.Position, mouse.Origin.p) end) end) end)
Doesn't work. Help? |
|
|
| Report Abuse |
|
|
th3oracle
|
  |
| Joined: 23 Feb 2013 |
| Total Posts: 448 |
|
| |
|
mic144
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 1598 |
|
|
| 16 Sep 2013 09:24 AM |
Output?
~ Please read this: http://wiki.roblox.com/index.php/User:Quenty/How_To_Receive_Help_From_Scripters ~ ●▂● |
|
|
| Report Abuse |
|
|
th3oracle
|
  |
| Joined: 23 Feb 2013 |
| Total Posts: 448 |
|
|
| 16 Sep 2013 06:26 PM |
Output: Selected is not a valid member of Tool
"tool.Selected:connect(function(mouse)" |
|
|
| Report Abuse |
|
|
| |
|
th3oracle
|
  |
| Joined: 23 Feb 2013 |
| Total Posts: 448 |
|
|
| 16 Sep 2013 06:38 PM |
| No. It's a Tool. When I tried using a Hopperbin it glitched. |
|
|
| Report Abuse |
|
|
|
| 16 Sep 2013 06:40 PM |
| Tools do not have the Selected event. You'd use the Equipped event. |
|
|
| Report Abuse |
|
|
th3oracle
|
  |
| Joined: 23 Feb 2013 |
| Total Posts: 448 |
|
|
| 16 Sep 2013 07:06 PM |
Here's my Localscript in the tool:
tool = script.Parent
tool.Equipped:connect(function(mouse) char = tool.Parent player = char:FindFirstChild(char.Name) ship = player.Ship bodygyro = Instance.new("BodyGyro") center = ship.Center bodygyro.Parent = center
mouse.KeyDown:connect(function(key) if key:lower() == "y" then totalmass = 0 c = game.Workspace.Ship:GetChildren() for i = #c, 1, -1 do if c[i].className == "Part" or c[i].className == "Seat" then m = c[i]:GetMass() totalmass = totalmass + m end end local bv = Instance.new("BodyVelocity") bv.Parent = center bv.velocity = center.CFrame.lookVector * 50 + totalmass end mouse.MouseButton1Down:connect(function(click) bodygyro.cframe = CFrame.new(center.Position, mouse.Origin.p) end) end) end)
Doesn't work, no output. |
|
|
| Report Abuse |
|
|
th3oracle
|
  |
| Joined: 23 Feb 2013 |
| Total Posts: 448 |
|
|
| 16 Sep 2013 07:23 PM |
| Someone debug my code please. |
|
|
| Report Abuse |
|
|
th3oracle
|
  |
| Joined: 23 Feb 2013 |
| Total Posts: 448 |
|
|
| 16 Sep 2013 08:57 PM |
| Is no one a skilled enough scripter to debug the code I provided? |
|
|
| Report Abuse |
|
|
|
| 16 Sep 2013 09:05 PM |
"Doesn't work, no output."
Most likely why. Add some prints here and there. |
|
|
| Report Abuse |
|
|