generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Plane

Previous Thread :: Next Thread 
th3oracle is not online. 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 is not online. th3oracle
Joined: 23 Feb 2013
Total Posts: 448
15 Sep 2013 03:34 PM
Bump.
Report Abuse
th3oracle is not online. th3oracle
Joined: 23 Feb 2013
Total Posts: 448
15 Sep 2013 04:43 PM
Bump[2]
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
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 is not online. 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
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
15 Sep 2013 05:27 PM
Yep.
Report Abuse
th3oracle is not online. th3oracle
Joined: 23 Feb 2013
Total Posts: 448
15 Sep 2013 05:29 PM
Thanks.
Report Abuse
th3oracle is not online. th3oracle
Joined: 23 Feb 2013
Total Posts: 448
15 Sep 2013 05:31 PM
Where does the BodyGyro go?
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
15 Sep 2013 05:36 PM
I'd say in the middle part so it doesn't look awkward when turning...
Report Abuse
PRESTIGIOUSaLEGEND is not online. PRESTIGIOUSaLEGEND
Joined: 16 Apr 2011
Total Posts: 1765
15 Sep 2013 05:38 PM
KeyDown returns a lowercase key so no need for translation :P
Report Abuse
th3oracle is not online. 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 is not online. 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
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
15 Sep 2013 09:16 PM
no, just in the center part
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
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 is not online. 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 is not online. th3oracle
Joined: 23 Feb 2013
Total Posts: 448
16 Sep 2013 09:20 AM
Help please.
Report Abuse
mic144 is not online. 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 is not online. 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
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
16 Sep 2013 06:27 PM
Is it a Hopperbin?
Report Abuse
th3oracle is not online. 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
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
16 Sep 2013 06:40 PM
Tools do not have the Selected event. You'd use the Equipped event.
Report Abuse
th3oracle is not online. 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 is not online. th3oracle
Joined: 23 Feb 2013
Total Posts: 448
16 Sep 2013 07:23 PM
Someone debug my code please.
Report Abuse
th3oracle is not online. 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
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
16 Sep 2013 09:05 PM
"Doesn't work, no output."

Most likely why. Add some prints here and there.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image