So far I got this
b = Instance.new("BodyVelocity") b.Parent = game.Workspace:IsA("Part")
But it does not work and I am confused as to how to add it to every single part in the workspace
for i,v in pairs(game.Workspace:GetChildren()) do if v:IsA("BasePart") then Instance.new("BodyVelocity",v) else end end
for _,v in pairs(Workspace:GetChildren()) do -- GetChildren returns a list of objects if v:IsA("BasePart") then -- aslong as it's a building part bv = Instance.new("BodyVelocity",v) end end
If you're using this as a sort of anti-gravity, you may be better with 'BodyForce', and setting force.Y to the part's mass * 187:
bf = Instance.new("BodyForce",v) -- for line 5 onward bf.force = Vector3.new(0,v:GetMass()*187,0) -- Mass of (v) * 187