I've been trying to make a gliding script, first time gliding works, but then when you jump you start flying up really fast
It's supposed to be when you press "space" while in the air, you start gliding, but then it makes some weird results
local uis = game:GetService("UserInputService")
local char = game.Players.LocalPlayer.Character
local mass = 0
for i, v in pairs(char:GetChildren()) do
if v:IsA("BasePart") then
mass = mass + v:GetMass()
end
end
local count = 0
local bv = Instance.new("BodyForce")
uis.InputBegan:Connect(function(input, gpe)
if not gpe and input.KeyCode == Enum.KeyCode.Space and count == 0 then
if char.Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
bv.Force = Vector3.new(0, (mass * workspace.Gravity) ,0)
bv.Parent = char.Torso
count = 1
else
bv.Force = Vector3.new(0, 0, 0)
count = 0
end
end
end)
