I have a script that loops through a model and replaces scripts with newer ones. I keep getting an error though that states that DriveSeat is not a valid member of part.
The script is:
local cars = game.ServerStorage:WaitForChild("cars"):GetChildren()
for i = 1,#cars do
local oldPickup = cars[i].DriveSeat.Pickup
if oldPickup ~= nil then
oldPickup:Destroy()
end
local newPickup = script.Pickup:Clone()
newPickup.Parent = cars[i].DriveSeat
local oldDrive = cars[i]:FindFirstChild("A-Chassis Tune"):FindFirstChild("A-Chassis Interface").Drive
if oldDrive ~= nil then
oldDrive:Destroy()
end
local newDrive = script.Drive:Clone()
newDrive.Parent = cars[i]:FindFirstChild("A-Chassis Tune"):FindFirstChild("A-Chassis Interface")
print("Car should have new files")
end
And the error is:
DriveSeat is not a valid member of Part
I’m unsure as to why I’m getting this error because if you look at the path of where the script is located, to me it seems to look ok and is the same for every model.
Thank you for any help…