-- TODO: Re-enable once appearance checking works
--print(game.Players.LocalPlayer:HasAppearanceLoaded())
--game:GetService("Players").LocalPlayer.CharacterAppearanceLoaded:wait()

wait()

local mass = 0
for _,v in pairs(root:GetConnectedParts(true)) do
	mass = mass + v:GetMass()
end

local vectorForce = Instance.new("VectorForce", root)
vectorForce.Name = "Gravity"
vectorForce.Attachment0 = root.RootRigAttachment
vectorForce.RelativeTo = Enum.ActuatorRelativeTo.World
vectorForce.ApplyAtCenterOfMass = true
vectorForce.Force = 196.2*mass*Vector3.new(0,-1,0)

humanoid.StateChanged:Connect(function(old, new)
	if new == Enum.HumanoidStateType.Dead or new == Enum.HumanoidStateType.Physics then
		vectorForce.Enabled = false
	else
		vectorForce.Enabled = true
	end
end)
