arshad145
|
  |
| Joined: 25 Feb 2014 |
| Total Posts: 98 |
|
|
| 13 Jul 2015 06:30 AM |
am new to lua but am not a beginner also... So anyone give me a hint to make a fly tool?
|
|
|
| Report Abuse |
|
|
|
| 13 Jul 2015 06:53 AM |
wait(0.1); local bg = Instance.new("BodyGyro"); bg.maxTorque = Vector3.new(math.huge,math.huge,math.huge); local plr = game.Players.LocalPlayer; local char = plr and plr.Character; local torso = char and char:FindFirstChild("Torso"); local speed = 100; -- in studs/second, for each second the player flys this many studs script.Parent.Selected:connect(function(mouse) bg.Parent = torso; mouse.Move:connect(function() local dir = (mouse.Hit.p-torso.Position).unit; bg.cframe = CFrame.new(mouse.Hit.p,mouse.Hit.p+dir); torso.Velocity = dir*100; end); end);
script.Parent.Deselected:connect(function() bg.Parent = script; end);
Place that inside a LocalScript, inside a Hopperbin, and place that in StarterPack. |
|
|
| Report Abuse |
|
|
arshad145
|
  |
| Joined: 25 Feb 2014 |
| Total Posts: 98 |
|
|
| 13 Jul 2015 06:55 AM |
| Thxs but I just wanted a hint and some explanations without bothering someone... :/ |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2015 07:05 AM |
| It's fine, good practice for me. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2015 07:05 AM |
@Cease
you forgot to use your speed var and used '100' instead xdd |
|
|
| Report Abuse |
|
|
| |
|
arshad145
|
  |
| Joined: 25 Feb 2014 |
| Total Posts: 98 |
|
|
| 13 Jul 2015 07:13 AM |
wait(0.1); local bg = Instance.new("BodyGyro"); bg.maxTorque = Vector3.new(math.huge,math.huge,math.huge); local plr = game.Players.LocalPlayer; local char = plr and plr.Character; local torso = char and char:FindFirstChild("Torso"); local speed = 100; -- in studs/second, for each second the player flys this many studs script.Parent.MouseButton1Click:connect(function(mouse)--The Fly was automatically selected then flying without mouse click I changed then its not working... bg.Parent = torso; mouse.Move:connect(function() local dir = (mouse.Hit.p-torso.Position).unit; bg.cframe = CFrame.new(mouse.Hit.p,mouse.Hit.p+dir); torso.Velocity = dir*100; end); end);
script.Parent.Deselected:connect(function() bg.Parent = script; end);
|
|
|
| Report Abuse |
|
|
arshad145
|
  |
| Joined: 25 Feb 2014 |
| Total Posts: 98 |
|
|
| 13 Jul 2015 07:15 AM |
I want to use the mouse click gui then activate fly...
|
|
|
| Report Abuse |
|
|
|
| 13 Jul 2015 07:20 AM |
gui.MouseButton1Down:connect(function()
end); |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2015 07:21 AM |
| Sorry, didn't see your edits, you may just have to edit it, shouldn't bee too difficult. |
|
|
| Report Abuse |
|
|
arshad145
|
  |
| Joined: 25 Feb 2014 |
| Total Posts: 98 |
|
|
| 13 Jul 2015 07:26 AM |
no problem Thanks again am gonna recreate it with my new knowledge obtained from you "Bodygyro" Thank once again and yes its easy now... |
|
|
| Report Abuse |
|
|
| |
|