|
| 30 Dec 2015 05:08 AM |
local FlyEvent = script.Parent:WaitForChild("Fly") local StopFlyEvent = script.Parent:WaitForChild("StopFly") local LandCooldown = script.Parent:WaitForChild("LandCooldown") local IsFlying = false local CanFly = true local BV = Instance.new("BodyVelocity",script.Parent.Parent:WaitForChild("HumanoidRootPart")) FlyEvent.OnServerEvent:connect(function() while CanFly == true do IsFlying = true BV.Velocity = Vector3.new(0,50,0) BV.MaxForce = Vector3.new(0,100000,0) wait(0.1) script.Parent.Fuel.Value = (script.Parent.Fuel.Value-1) if script.Parent.Fuel.Value == 0 then CanFly = false BV.Velocity = Vector3.new(0,0,0) BV.MaxForce = Vector3.new(0,0,0) end end end) StopFlyEvent.OnServerEvent:connect(function() BV.Velocity = Vector3.new(0,0,0) BV.MaxForce = Vector3.new(0,0,0) IsFlying = false end) while CanFly == false do script.Parent.Fuel.Value = (script.Parent.Fuel.Value+1) wait (0.2) if script.Parent.Fuel.Value == 100 then CanFly = true end end
What I'm trying to do is make it so that when the jetpack is being used, the fuel (which maxes out at 100, and is set at 100 by default) goes down, and when it is not being used, it refills faster, however this is not what is happening, the jetpack continues to fly up until it reaches 0, (sometimes it goes under 0) and then falls back down to the ground, and the fuel does not fill up.
Help!?
~IanSplodge, Walrus God of the Forums. |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 05:19 AM |
Bump
~IanSplodge, Walrus God of the Forums. |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 06:57 AM |
Could I please have some help?
~IanSplodge, Walrus God of the Forums. |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 07:01 AM |
It's always me that gets ignored...
~IanSplodge, Walrus God of the Forums. |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 07:12 AM |
Bumpin' it up
~IanSplodge, Walrus God of the Forums. |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 07:14 AM |
Uh.. Don't you need a FireServer() first?
The Legend of Heroes Sen no Kiseki |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 07:15 AM |
Here's my localscript: local FlyEvent = script.Parent:WaitForChild("Fly") local StopFlyEvent = script.Parent:WaitForChild("StopFly") local LandCooldown = script.Parent:WaitForChild("LandCooldown") local UIS = game:GetService("UserInputService") local Human = script.Parent.Parent:WaitForChild("Humanoid")
UIS.InputBegan:connect(function(key,GPE) if not GPE and key.KeyCode == Enum.KeyCode.Space then if not GPE and key.KeyCode == Enum.KeyCode.Space and Human.Jump == true then FlyEvent:FireServer() end end end)
UIS.InputEnded:connect(function(key,GPE) if not GPE and key.KeyCode == Enum.KeyCode.Space then StopFlyEvent:FireServer() end end)
~IanSplodge, Walrus God of the Forums. |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 07:19 AM |
Still no closer to help...
~IanSplodge, Walrus God of the Forums. |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 07:29 AM |
local FlyEvent = script.Parent:WaitForChild("Fly") local StopFlyEvent = script.Parent:WaitForChild("StopFly") local LandCooldown = script.Parent:WaitForChild("LandCooldown") local IsFlying = false local CanFly = true local p = script.Parent.Parent.Parent or game.Players:GetPlayerFromCharacter(script.Parent.Parent) local c = p.Character local BV = Instance.new("BodyVelocity", c.HumanoidRootPart) BV.Velocity = Vector3.new(0,0,0) BV.MaxForce = Vector3.new(0,0,0)
FlyEvent.OnServerEvent:connect(function() while CanFly == true do IsFlying = true BV.Velocity = Vector3.new(0,50,0) BV.MaxForce = Vector3.new(0,100000,0) wait(0.1) script.Parent.Fuel.Value = (script.Parent.Fuel.Value-1) if script.Parent.Fuel.Value == 0 then CanFly = false BV.Velocity = Vector3.new(0,0,0) BV.MaxForce = Vector3.new(0,0,0) end end end)
StopFlyEvent.OnServerEvent:connect(function() if BV then BV.Velocity = Vector3.new(0,0,0) BV.MaxForce = Vector3.new(0,0,0) IsFlying = false end end)
while CanFly == false do script.Parent.Fuel.Value = (script.Parent.Fuel.Value+1) wait (0.2) if script.Parent.Fuel.Value == 100 then CanFly = true end end
The Legend of Heroes Sen no Kiseki |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 07:33 AM |
That does the same thing as mine, only the fuel depletes a lot slower. You cannot stop flying until the fuel is out, and the fuel does not regenerate.
~IanSplodge, Walrus God of the Forums. |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 07:46 AM |
local FlyEvent = script.Parent:WaitForChild("Fly") local StopFlyEvent = script.Parent:WaitForChild("StopFly") local LandCooldown = script.Parent:WaitForChild("LandCooldown") local IsFlying = false local CanFly = true local p = script.Parent.Parent.Parent or game.Players:GetPlayerFromCharacter(script.Parent.Parent) local c = p.Character local BV
FlyEvent.OnServerEvent:connect(function() local x = Instance.new("BodyVelocity", c.HumanoidRootPart) BV = x while CanFly == true do IsFlying = true BV.Velocity = Vector3.new(0,50,0) BV.MaxForce = Vector3.new(0,100000,0) wait(0.1) script.Parent.Fuel.Value = (script.Parent.Fuel.Value-1) if script.Parent.Fuel.Value == 0 then CanFly = false BV.Velocity = Vector3.new(0,0,0) BV.MaxForce = Vector3.new(0,0,0) end end end)
StopFlyEvent.OnServerEvent:connect(function() BV:Destroy() IsFlying = false end)
while CanFly == false do script.Parent.Fuel.Value = (script.Parent.Fuel.Value+1) wait(0.2) if script.Parent.Fuel.Value == 100 then CanFly = true end end
local script
local p = game.Players.LocalPlayer repeat wait() until p.Character local c = p.Character local FlyEvent = script.Parent:WaitForChild("Fly") local StopFlyEvent = script.Parent:WaitForChild("StopFly") local LandCooldown = script.Parent:WaitForChild("LandCooldown") local UIS = game:GetService("UserInputService") local Human = c.Humanoid local jump = false
UIS.InputBegan:connect(function(key,GPE) if not GPE then if key.KeyCode == Enum.KeyCode.Space then if Human.Jump == true then FlyEvent:FireServer() jump = true end end end end)
UIS.InputEnded:connect(function(key,GPE) if not GPE then if key.KeyCode == Enum.KeyCode.Space then if jump == true then print'hi' StopFlyEvent:FireServer() jump = false end end end end)
The Legend of Heroes Sen no Kiseki |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 07:52 AM |
Fuel continues to go down, and does not go back up when the jetpack is stopped.
~IanSplodge, Walrus God of the Forums. |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 08:04 AM |
local FlyEvent = script.Parent:WaitForChild("Fly") local StopFlyEvent = script.Parent:WaitForChild("StopFly") local LandCooldown = script.Parent:WaitForChild("LandCooldown") local IsFlying = false local CanFly = true local p = script.Parent.Parent.Parent or game.Players:GetPlayerFromCharacter(script.Parent.Parent) local c = p.Character local BV
FlyEvent.OnServerEvent:connect(function() local x = Instance.new("BodyVelocity", c.HumanoidRootPart) BV = x while CanFly == true do IsFlying = true BV.Velocity = Vector3.new(0,50,0) BV.MaxForce = Vector3.new(0,100000,0) wait(0.1) script.Parent.Fuel.Value = (script.Parent.Fuel.Value-1) if script.Parent.Fuel.Value == 0 then CanFly = false BV.Velocity = Vector3.new(0,0,0) BV.MaxForce = Vector3.new(0,0,0) end end end)
StopFlyEvent.OnServerEvent:connect(function() BV:Destroy() IsFlying = false CanFly = false wait() end)
while wait() do while script.Parent.Fuel.Value ~= script.Parent.Fuel.MaxValue and IsFlying == false do script.Parent.Fuel.Value = (script.Parent.Fuel.Value+1) wait(0.2) if script.Parent.Fuel.Value == 100 then CanFly = true end end end
The Legend of Heroes Sen no Kiseki |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 08:07 AM |
local FlyEvent = script.Parent:WaitForChild("Fly") local StopFlyEvent = script.Parent:WaitForChild("StopFly") local LandCooldown = script.Parent:WaitForChild("LandCooldown") local IsFlying = false local CanFly = true local p = script.Parent.Parent.Parent or game.Players:GetPlayerFromCharacter(script.Parent.Parent) local c = p.Character local BV
FlyEvent.OnServerEvent:connect(function() local x = Instance.new("BodyVelocity", c.HumanoidRootPart) BV = x while CanFly == true do IsFlying = true BV.Velocity = Vector3.new(0,50,0) BV.MaxForce = Vector3.new(0,100000,0) wait(0.1) script.Parent.Fuel.Value = (script.Parent.Fuel.Value-1) if script.Parent.Fuel.Value == 0 then CanFly = false BV.Velocity = Vector3.new(0,0,0) BV.MaxForce = Vector3.new(0,0,0) end end end)
StopFlyEvent.OnServerEvent:connect(function() BV:Destroy() IsFlying = false CanFly = false wait() end)
while wait() do while script.Parent.Fuel.Value ~= script.Parent.Fuel.MaxValue and IsFlying == false do script.Parent.Fuel.Value = (script.Parent.Fuel.Value+1) wait(0.2) if script.Parent.Fuel.Value >= script.Parent.Fuel.MinValue then CanFly = true end end end
The Legend of Heroes Sen no Kiseki |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 08:12 AM |
Thanks so much, I just have to add a few more things and it's done! You truly are amazing.
~IanSplodge, Walrus God of the Forums. |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 08:13 AM |
It took 3 hours for you to finish this qq
The Legend of Heroes Sen no Kiseki |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 08:14 AM |
Well I've also been multi tasking ;3
~IanSplodge, Walrus God of the Forums. |
|
|
| Report Abuse |
|
|