Hello there, I am trying to make a jetpack to add to my game but it will keep glitching during flight. I have used the AssemblyLinearVelocity many times to launch players but this time it is not working.
I have tried looking on YouTube and The Developer Hub for ways to solve this but haven’t found anything.
while true do
if flying == true and fuel > 0 then
---- Use Fuel
fuel = fuel - 1
---- Set the Gui To See Fuel Level
setSize = fuel / 1000
setPos = (setSize * -1) + 1
player.PlayerGui.PlayerStats.JetpackFuel.Backdrop.FuelLevel.Size = UDim2.new(1,0,setSize,0)
player.PlayerGui.PlayerStats.JetpackFuel.Backdrop.FuelLevel.Position = UDim2.new(0,0,setPos,0)
---- Boost Them Into The Sky
hrp.AssemblyLinearVelocity = Vector3.new(hrp.AssemblyLinearVelocity.X,hrp.AssemblyLinearVelocity.Y + 1000,hrp.AssemblyLinearVelocity.Z)
end
wait(0.1)
end
function jetpack.update()
if jetpack.flying then
jetpack.useFuel()
else
jetpack.regenFuel()
end
end
function jetpack.useFuel()
if jetpack.fuel > 0 then
jetpack.fuel = jetpack.fuel - 1
jetpack.jetpack.Parent.HumanoidRootPart.AssemblyLinearVelocity = Vector3.new(
jetpack.jetpack.Parent.HumanoidRootPart.AssemblyLinearVelocity.X,
jetpack.jetpack.Parent.HumanoidRootPart.AssemblyLinearVelocity.Y + 1000,
jetpack.jetpack.Parent.HumanoidRootPart.AssemblyLinearVelocity.Z
)
jetpack.renderFuel()
else
jetpack.stopFlying()
end
end
function jetpack.regenFuel()
if jetpack.fuel < jetpack.fuelMax then
local time = os.time()
if time >= jetpack.fuelRegenTimer then
jetpack.fuel = jetpack.fuel + jetpack.fuelRegen
if jetpack.fuel > jetpack.fuelMax then
jetpack.fuel = jetpack.fuelMax
end
jetpack.fuelRegenTimer = time + jetpack.fuelRegenDelay
jetpack.renderFuel()
end
end
end
function jetpack.renderFuel()
– Set the Gui To See Fuel Level
setSize = jetpack.fuel / jetpack.fuelMax
setPos = (setSize * -1) + 1
jetpack.jet