im trying to make a hover car. at the moment i just want it to float really but i can’t get it to float at all. the gravity keeps pulling it down.
local function makecar_float()
local grav = workspace.Gravity
local totalmass = 0
makecharMassless(true, c)
--calculate total mass of car
for _, instance in ipairs(zalek:GetDescendants()) do
if instance:IsA("BasePart") or instance:IsA("VehicleSeat") or instance:IsA("Seat") then
totalmass += instance:GetMass()
end
end
for _, car_part in ipairs(zalek:GetDescendants()) do
if car_part:IsA("BasePart") or car_part:IsA("VehicleSeat") or car_part:IsA("Seat") then
local gravity_force = totalmass * grav
local vf_attachment0 = Instance.new("Attachment", car_part)
vf_attachment0.Name = car_part.Name.."_VFatt0"
local vf_attachment1 = Instance.new("Attachment", car_part)
vf_attachment1.Name = car_part.Name.."_VFatt1"
local vectorForce = Instance.new("VectorForce", car_part)
vectorForce.Name = car_part.Name .. "_vf"
vectorForce.Attachment0 = vf_attachment0
vectorForce.Attachment1 = vf_attachment1
vectorForce.Force = Vector3.new(0, gravity_force, 0)
end
end
zalek:PivotTo(CFrame.new(0,50,0))
end