I'm trying to add a a script that would make unanchored parts when released fall at a slower rate than normal, due to (in real life) air resistance.
Exactly what LateralLace said: Use a BodyForce to cancel out a fraction of the gravity effects
Put a BodyForce in your parts with the Y force set to a fraction of 196.2*mass
local gravity = 0.9; --Relative, 1 is normal gravity and 0 is none local gd = function(i) local queue = {}; local returns = {}; local v = i; while v do local t = v:GetChildren(); for i = 1, #t do local v = t[i] returns[#returns+1] = v; queue[#queue+1] = v; end; v = queue[#queue]; queue[#queue] = nil; end; return returns; end; gravity = 1-gravity; -- Shh shh for k,v in next, gd(workspace) do if not d:IsA("BasePart") then return end; local ag = Instance.new("BodyForce"); ag.Name = "AirResistanceHandle"; ag.force = Vector3.new(0,196.2*v:GetMass()*gravity,0); ag.Parent = v; end; workspace.DescendantAdded:connect(function(d) if not d:IsA("BasePart") then return end; local ag = Instance.new("BodyForce"); ag.Name = "AirResistanceHandle"; ag.force = Vector3.new(0,196.2*d:GetMass()*gravity,0); ag.Parent = d; end); workspace.DescendantRemoving:connect(function(d) if d:FindFirstChild("AirResistanceHandle") then d.AirResistanceHandle:Destroy(); end end);
What's going on here?
First, I get all of the descendants in the workspace. The function used for that can be found in Valkyrie. Then, I add a bodyforce to them and set it to cancel out a fraction of gravity. I do the same to any new additions to the workspace. Then I destroy it if the part leaves the workspace because I'm far too lazy.
Resources: