local Players = game:GetService("Players") local RunService = game:GetService("RunService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local player = Players.LocalPlayer local anims = ReplicatedStorage:WaitForChild("Assets"):WaitForChild("Tools"):WaitForChild("Jetpack"):WaitForChild("Types"):WaitForChild("Jetpack"):WaitForChild("Animations") local activeAnim = nil local flyState = "FlyHover" local isFlying = false local attachment, alignOrientation, linearVelocity local charConnection local function createJetpack() local tool = Instance.new("Tool") tool.Name = "Jetpack" tool.CanBeDropped = false tool.RequiresHandle = false tool.TextureId = "rbxassetid://1362932274" local scriptItem = Instance.new("LocalScript") scriptItem.Name = "ToolClient" scriptItem.Disabled = true scriptItem.Parent = tool local objValue = Instance.new("ObjectValue") objValue.Name = "Object" objValue.Parent = scriptItem return tool end local function giveJetpack() local backpack = player:WaitForChild("Backpack") if not backpack:FindFirstChild("Jetpack") and (not player.Character or not player.Character:FindFirstChild("Jetpack")) then local tool = createJetpack() tool.Parent = backpack end end local function clearSeatWeld(char) local hum = char:FindFirstChild("Humanoid") if hum and hum.SeatPart and hum.SeatPart:FindFirstChild("SeatWeld") then for _, child in pairs(hum.SeatPart:GetChildren()) do if child.Name == "SeatWeld" then child:Destroy() end end end end local function playAnim(animName) local char = player.Character if not char then return end local hum = char:FindFirstChild("Humanoid") if not hum then return end local animator = hum:FindFirstChild("Animator") if not animator or player:GetAttribute("VR") then return end local animObj = anims:FindFirstChild(animName) if not animObj then return end if activeAnim then if activeAnim.Animation.AnimationId == animObj.AnimationId then return end activeAnim:Stop(0.3) end local track = animator:LoadAnimation(animObj) track.Priority = Enum.AnimationPriority.Movement track:Play(0.3) activeAnim = track end local function onFlyStep(dt) local char = player.Character if not char or not alignOrientation or not linearVelocity then return end local hum = char:FindFirstChild("Humanoid") if not hum then return end local cam = workspace.CurrentCamera local moveDir = hum.MoveDirection local localMove = cam.CFrame:VectorToObjectSpace(moveDir) flyState = localMove.Z < -0.1 and "Flying" or (localMove.Z > 0.1 and "FlyBack" or (localMove.X > 0.1 and "FlyRight" or (localMove.X < -0.1 and "FlyLeft" or "FlyHover"))) local speed = flyState == "Flying" and 80 or (flyState == "FlyBack" and 60 or 64) local targetDir = Vector3.new(0, 0, 0) if moveDir.Magnitude >= 0.1 then local look = cam.CFrame.LookVector local right = cam.CFrame.RightVector targetDir = (-localMove.Z * look + localMove.X * right).Unit end local targetVel = targetDir * speed linearVelocity.VectorVelocity = targetVel playAnim(flyState) local targetCFrame if targetVel.Magnitude > 1 then if flyState == "Flying" or flyState == "FlyBack" then local yaw = math.atan2(localMove.X, math.abs(localMove.Z)) * math.sign(localMove.Z) targetCFrame = cam.CFrame * CFrame.Angles(0, yaw, 0) else targetCFrame = cam.CFrame end else local _, yaw, _ = alignOrientation.CFrame:ToEulerAnglesYXZ() targetCFrame = CFrame.Angles(0, yaw, 0) end alignOrientation.CFrame = alignOrientation.CFrame:Lerp(targetCFrame, dt * 10) clearSeatWeld(char) end local function stopFlying(char, hum) if not isFlying then return end isFlying = false RunService:UnbindFromRenderStep("FlyBinding") if activeAnim then activeAnim:Stop() activeAnim = nil end if alignOrientation then alignOrientation:Destroy() end if linearVelocity then linearVelocity:Destroy() end if attachment then attachment:Destroy() end if hum then hum.AutoRotate = true hum.PlatformStand = false hum:SetStateEnabled(Enum.HumanoidStateType.Seated, true) end if char then char:SetAttribute("Flying", false) end end local function startFlying(char, hum, root) if isFlying then return end isFlying = true attachment = Instance.new("Attachment") attachment.Name = "JetpackAttachment" attachment.Parent = root alignOrientation = Instance.new("AlignOrientation") alignOrientation.Name = "FlyOrientation" alignOrientation.Mode = Enum.OrientationAlignmentMode.OneAttachment alignOrientation.Attachment0 = attachment alignOrientation.Responsiveness = 100 alignOrientation.Enabled = true alignOrientation.RigidityEnabled = true alignOrientation.CFrame = root.CFrame alignOrientation.Parent = root linearVelocity = Instance.new("LinearVelocity") linearVelocity.Name = "FlyVelocity" linearVelocity.MaxForce = 10000000000000 linearVelocity.Attachment0 = attachment linearVelocity.RelativeTo = Enum.ActuatorRelativeTo.World linearVelocity.Parent = root hum.AutoRotate = false hum.PlatformStand = true hum:SetStateEnabled(Enum.HumanoidStateType.Seated, false) char:SetAttribute("Flying", true) RunService:BindToRenderStep("FlyBinding", Enum.RenderPriority.Camera.Value - 1, onFlyStep) playAnim("FlyHover") end local function setupCharacter(char) if charConnection then charConnection:Disconnect() end isFlying = false task.wait(0.5) giveJetpack() local hum = char:WaitForChild("Humanoid") local root = char:WaitForChild("HumanoidRootPart") charConnection = char.ChildAdded:Connect(function(child) if child:IsA("Tool") and child.Name == "Jetpack" then task.defer(function() hum:UnequipTools() end) if isFlying then stopFlying(char, hum) else startFlying(char, hum, root) end end end) end giveJetpack() if player.Character then setupCharacter(player.Character) end player.CharacterAdded:Connect(setupCharacter) print("Xsaf, a love it")