The body force does not apply its upward force until the hrp has an initial velocity
local plr=game:GetService'Players'.LocalPlayer
local char=plr.Character or plr.CharacterAdded:Wait()
wait(1)
local hrp=char:WaitForChild'HumanoidRootPart'
local bf=Instance.new'BodyForce'
bf.Parent=hrp
game:GetService'RunService'.Heartbeat:Connect(function(dt)
local totalmass=0
for _,p in next,char:GetDescendants()do
if p:IsA'BasePart'then
totalmass=totalmass+p:GetMass()
end
end
bf.Force=Vector3.new(0,totalmass*workspace.Gravity,0)*10
end)
Well it doesn’t have to be in a loop
It happens in APS, two player local server, my windows 10 computer, and my friend’s windows 10 computer zzz.rbxl (14.3 KB)
use vector force + attachment to avoid broken physics sleeping bugs
stop use bodyforce/gyro/whatever
local plr=game:GetService'Players'.LocalPlayer
local char=plr.Character or plr.CharacterAdded:Wait()
wait(1)
local hrp=char:WaitForChild'HumanoidRootPart'
local at = Instance.new("Attachment")
at.Parent = hrp
at.CFrame = hrp.CFrame
local vf = Instance.new("VectorForce")
vf.Parent = hrp
vf.Attachment0 = at
vf.RelativeTo = "World"
vf.ApplyAtCenterOfMass = true
game:GetService'RunService'.Heartbeat:Connect(function(dt)
local totalmass=0
for _,p in next,char:GetDescendants()do
if p:IsA'BasePart'then
totalmass=totalmass+p:GetMass()
end
end
vf.Force=Vector3.new(0,totalmass*workspace.Gravity,0)*10
end)
When the velocity is 0 on Y, it does not accelerate and makes you stay on the ground, until you jump, fall or anything with velocity on Y.
Removing the wait(1) and spawning will cause the player to fly up immediately, due to the fact the player started with a velocity down. BodyForce causes the cancelling of gravity and there was additional acceleration up, causing player to fly.
BodyVelocity recommended combined with BodyForce to nullify gravity. Then you can have a constant speed up from BodyVelocity while BodyForce stops the gravity from ‘pulling’ the player down.