local a={}function getSeats(R)for R,y in pairs(R:GetChildren())do if y:IsA("\086\101\104\105\099\108\101\083\101\097\116")or y:IsA("\083\101\097\116")then local R={}R.Seat=y R.Parts={}table.insert(a,R)end getSeats(y)end end getSeats(car)function getPProperties(a,R)for a,y in pairs(a:GetChildren())do if y:IsA("\066\097\115\101\080\097\114\116")then if y.CustomPhysicalProperties==nil then y.CustomPhysicalProperties=PhysicalProperties.new(y.Material)end table.insert(R,{y,y.CustomPhysicalProperties})y.CustomPhysicalProperties=PhysicalProperties.new(0,y.CustomPhysicalProperties.Friction,y.CustomPhysicalProperties.Elasticity,y.CustomPhysicalProperties.FrictionWeight,y.CustomPhysicalProperties.ElasticityWeight)end getPProperties(y,R)end end for a,R in pairs(a)do R.Seat.ChildAdded:connect(function(a)if a.Name=="\083\101\097\116\087\101\108\100"and(a:IsA("\087\101\108\100")and(a.Part1~=nil and(a.Part1.Parent~=workspace and not a.Part1.Parent:IsDescendantOf(car))))then R.Parts={}getPProperties(a.Part1.Parent,R.Parts)end end)R.Seat.ChildRemoved:connect(function(a)if a.Name=="\083\101\097\116\087\101\108\100"and a:IsA("\087\101\108\100")then for a,R in pairs(R.Parts)do if R[1]~=nil and(R[2]~=nil and R[1]:IsDescendantOf(workspace))then R[1].CustomPhysicalProperties=R[2]end end R.Parts={}end end)end
--[[Remove Character Weight]]
--Get Seats
local Seats = {}
function getSeats(p)
	for i, v in pairs(p:GetChildren()) do
		if v:IsA("VehicleSeat") or v:IsA("Seat") then
			local seat = {}
			seat.Seat = v
			seat.Parts = {}
			table.insert(Seats, seat)
		end
		getSeats(v)
	end
end
getSeats(car)

--Store Physical Properties/Remove Mass Function
function getPProperties(mod, t)
	for i, v in pairs(mod:GetChildren()) do
		if v:IsA("BasePart") then
			if v.CustomPhysicalProperties == nil then
				v.CustomPhysicalProperties = PhysicalProperties.new(v.Material)
			end
			table.insert(t, { v, v.CustomPhysicalProperties })
			v.CustomPhysicalProperties = PhysicalProperties.new(
				0,
				v.CustomPhysicalProperties.Friction,
				v.CustomPhysicalProperties.Elasticity,
				v.CustomPhysicalProperties.FrictionWeight,
				v.CustomPhysicalProperties.ElasticityWeight
			)
		end
		getPProperties(v, t)
	end
end

--Apply Seat Handler
for i, v in pairs(Seats) do
	--Sit Handler
	v.Seat.ChildAdded:connect(function(child)
		if
			child.Name == "SeatWeld"
			and child:IsA("Weld")
			and child.Part1 ~= nil
			and child.Part1.Parent ~= workspace
			and not child.Part1.Parent:IsDescendantOf(car)
		then
			v.Parts = {}
			getPProperties(child.Part1.Parent, v.Parts)
		end
	end)

	--Leave Handler
	v.Seat.ChildRemoved:connect(function(child)
		if child.Name == "SeatWeld" and child:IsA("Weld") then
			for i, v in pairs(v.Parts) do
				if v[1] ~= nil and v[2] ~= nil and v[1]:IsDescendantOf(workspace) then
					v[1].CustomPhysicalProperties = v[2]
				end
			end
			v.Parts = {}
		end
	end)
end
