well i made a script that is supposed to weld a body in a vehicleseat. It works, but for other players it just falls off.

local parts = script.Parent:GetDescendants()
wait(1)
for i = 1, #parts do
	if parts[i]:IsA("MeshPart") then
		local w = Instance.new("Weld")
		w.Part0 = script.Parent.Parent.VehicleSeat
		w.Part1 = parts[i]
		w.C0 = script.Parent.Parent.VehicleSeat.CFrame:Inverse() *script.Parent.Parent.VehicleSeat.CFrame
		w.C1 = parts[i].CFrame:inverse() * script.Parent.Parent.VehicleSeat.CFrame
		w.Parent = script.Parent.Parent.VehicleSeat
	end 
	
		if parts[i]:IsA("Part") then
		local w = Instance.new("Weld")
		w.Part0 = script.Parent.Parent.VehicleSeat
		w.Part1 = parts[i]
		w.C0 = script.Parent.Parent.VehicleSeat.CFrame:Inverse() *script.Parent.Parent.VehicleSeat.CFrame
		w.C1 = parts[i].CFrame:inverse() * script.Parent.Parent.VehicleSeat.CFrame
		w.Parent = script.Parent.Parent.VehicleSeat
		end 
				if parts[i]:IsA("UnionOperation") then
		local w = Instance.new("Weld")
		w.Part0 = script.Parent.Parent.VehicleSeat
		w.Part1 = parts[i]
		w.C0 = script.Parent.Parent.VehicleSeat.CFrame:Inverse() *script.Parent.Parent.VehicleSeat.CFrame
		w.C1 = parts[i].CFrame:inverse() * script.Parent.Parent.VehicleSeat.CFrame
		w.Parent = script.Parent.Parent.VehicleSeat
				end 
						if parts[i]:IsA("BasePart") then
		local w = Instance.new("Weld")
		w.Part0 = script.Parent.Parent.VehicleSeat
		w.Part1 = parts[i]
		w.C0 = script.Parent.Parent.VehicleSeat.CFrame:Inverse() *script.Parent.Parent.VehicleSeat.CFrame
		w.C1 = parts[i].CFrame:inverse() * script.Parent.Parent.VehicleSeat.CFrame
		w.Parent = script.Parent.Parent.VehicleSeat
						end 
								if parts[i]:IsA("WedgePart") then
		local w = Instance.new("Weld")
		w.Part0 = script.Parent.Parent.VehicleSeat
		w.Part1 = parts[i]
		w.C0 = script.Parent.Parent.VehicleSeat.CFrame:Inverse() *script.Parent.Parent.VehicleSeat.CFrame
		w.C1 = parts[i].CFrame:inverse() * script.Parent.Parent.VehicleSeat.CFrame
		w.Parent = script.Parent.Parent.VehicleSeat
		end 
end

2 comments

0

nice text art there

0

Is this a localscript or a server script?