Hi, I was trying to make it so that when the player is make it so that the player's jump height would stay the same, but if they press and hold space while midair, they would have a lighter fall aka reach the ground slower. This is what I have so far client
elseif inputObject.KeyCode == Enum.KeyCode.Space then if player.Character.Humanoid.Jump == true then floating:FireServer("start") end end end) UIS.InputEnded:connect(function(inputObject) if inputObject.KeyCode == Enum.KeyCode.Space then floating:FireServer("stop") end end)
server
floatingevent.OnServerEvent:connect(function(player,startorstop) if script.Parent.Parent:FindFirstChild("Humanoid").Torso:FindFirstChild("floater") then floater = script.Parent.Parent:FindFirstChild("Humanoid").Torso:FindFirstChild("floater") else floater = Instance.new("BodyForce", script.Parent.Parent:FindFirstChild("Humanoid").Torso) floater.Name = "floater" end if startorstop == "start" then floater.Force = Vector3.new(0,game.Workspace.Gravity,0) * script.Parent.Parent:FindFirstChild("Humanoid").Torso:GetMass()* 2.5 end if startorstop == "stop" then floater.Force = Vector3.new(0,0,0) end script.Parent.Parent:FindFirstChild("Humanoid").FreeFalling:connect(function() floater = script.Parent.Parent:FindFirstChild("Humanoid").Torso:FindFirstChild("floater") floater.Force = Vector3.new(0,game.Workspace.Gravity,0) * script.Parent.Parent:FindFirstChild("Humanoid").Torso:GetMass()* 2.5 end) end)
The problem with the script is that it alters the player's jump height and not the player's fall speed.
Create a BodyForce only when the character's HumanoidStateType is Enum.HumanoidStateType.Freefall, then delete it when it gets changed to anything else.
Also, you can add the capability you are talking about by changing the body force's Force whenever the space button is pressed using ContextActionService.
local character = player.Character -- the character local humanoid = character.Humanoid -- the humanoid of the character local function createBodyForce(character) -- function to make a body force here -- also have a function here to "listen" for a space push/hold. -- pseudocode: if space held or space pushed then bodyForce.Force = some non-zero Vector3 else bodyForce.Force = Vector3.new(0, 0, 0) end end local function destroyBodyForce(character) -- function to destroy a body force here end humanoid.StateChanged:Connect(function(old, new) if new == Enum.HumanoidStateType.Freefall then createBodyForce(character) else destroyBodyForce(character) end end)