Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why jetpack script with BodyVelocity isnt working?

Asked by 5 years ago

Hey, Today i was trying to make an jetpack script. But why it isn't working?

local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")

local Player = Players.LocalPlayer
local JetpackGui = Player:FindFirstChild("PlayerGui"):WaitForChild("JetpackGui")
local JetpackFrame = JetpackGui:WaitForChild("JetpackFrame")
local Kalan = JetpackFrame:WaitForChild("Kalan")

local Yakit = Player:FindFirstChild("Configs"):WaitForChild("Yakit")
function key(inputObject, GPE)
    if not GPE then
        if inputObject.KeyCode == Enum.KeyCode.F then
            JetpackFrame.Visible = true

            if Yakit.Value >1 then
                game:GetService("ServerStorage"):WaitForChild("BodyVelocity"):Clone().Parent = Player.Character:WaitForChild("Head")

                local BodyVelocity = Player.Character:WaitForChild("Head"):WaitForChild("BodyVelocity")
                BodyVelocity.MaxForce = BodyVelocity.MaxForce +Vector3.new(0, 4000, 0)

                Kalan.Text = Player:FindFirstChild("Configs"):WaitForChild("Yakit").Value -1
                wait(.3)
                return 15
            else
                Player.Character:WaitForChild("Head"):WaitForChild("BodyVelocity"):Destroy()
                repeat
                    Yakit.Value = Yakit.Value +1
                    Kalan.Text = Yakit.Value
                    wait(.3)
                until Yakit.Value >9 or Yakit.Value == 10
            end
        end
    end
end
UserInputService.InputBegan:Connect(key)

There aren't errors on OUTPUT!

Answer this question