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

Am I floating a character wrong?

Asked by 6 years ago
Edited 6 years ago

I'm attempting to make a character float. Here is my script


function getMass(model) local weight = 0 if model:IsA("BasePart") then return model:GetMass() end if #model:GetChildren()>0 then for _,v in pairs(model:GetChildren()) do weight = weight + getMass(v) end end return weight end game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) local character=player.CharacterAppearanceLoaded:Wait() local mass = getMass(character) local force = Instance.new("BodyForce",character.LowerTorso) force.force = Vector3.new(0,196.2*getMass(character),0) end) end)

I'm adding a force in the lower torso equal to 196.2 * the total mass of the character including hats etc. It seems that's too much and the character is rising. I have no idea why.

0
your Force.Y ? User#17685 0 — 6y
0
Ends up being 5386.631 which is apparently too much for the weight. This means it's calculating the weight to be 27 or so which I guess is too much? jinxsimpson 0 — 6y
0
small tip: idk why you would change this value but you should use workspace.Gravity instead of 192.6 fanofpixels 718 — 6y

Answer this question