Im creating a jetpack that will rotate the player 90 degrees so they face down, then have a bodyvelocity push them forward, however I seem to have one major issue.
I need the character to still be able to rotate themselves on the y axis while in flight.
the players character will try to resist when I rotate them via bodygyro.
I tried enabling platformstand but this means the character wont be able to be controlled.
I thought about assigning a keybind to have them rotate but what if the user has a mobile device, it would seem to be simpler and easier to preserve player control instead of using this method.
what should I do? here is my current progress:
local mode = "Hover"
local stabilizer
local thruster
local jetpack
local tool = script.Parent
function changes()
if tool.Parent and tool.Parent.PrimaryPart then
if mode == "Hover" and stabilizer == nil and thruster == nil then
stabilizer = Instance.new("BodyGyro")
stabilizer.Parent = tool.Parent.PrimaryPart
stabilizer.MaxTorque = Vector3.new(100000,0,100000)
thruster = Instance.new("BodyVelocity")
thruster.Parent = tool.Parent.PrimaryPart
thruster.MaxForce = Vector3.new(0,40000,0)
thruster.Velocity = Vector3.new(0,-5,0)
end
if mode == "Boost" and thruster ~= nil then
thruster.Velocity = Vector3.new(0,15,0)
end
if mode == "Glide" and stabilizer ~= nil and thruster ~= nil then
tool.Parent.Humanoid.PlatformStand = true
stabilizer.MaxTorque = Vector3.new(100000000,100000000,0)
stabilizer.CFrame = tool.Parent.PrimaryPart.CFrame * CFrame.Angles(math.rad(-90),0,0)
wait(1)
thruster.MaxForce = Vector3.new(40000,40000,40000)
thruster.Velocity = tool.Parent.PrimaryPart.CFrame.UpVector * 30
end
end
script.Parent.Activated:Connect(function()
if mode == "Hover" then
mode = "Boost"
changes()
elseif mode == "Boost" then
mode = "Glide"
changes()
elseif mode == "Glide" then
mode = "Hover"
changes()
end
end)
script.Parent.Equipped:Connect(function()
mode = "Hover"
changes()
end)
script.Parent.Unequipped:Connect(function()
end)