Script not cloning

  1. What do you want to achieve?
    Cloning 1 item into multi objects such as into a vehicle seat

  2. What is the issue? Include screenshots / videos if possible!
    script has no typo nor errors appear and only prints 1 time

Main issue is that it’s a radio that’s in multiple vehicles seats, having to go edit each one would take a long time and mistakes/errors can go wrong having to redo all the radios again so to prevent that. The radio is inside a folder value which will clone 2 items but, let’s just stick to 1 item, at first it seems to work until getting into the cars and not cloning the radio inside the vehicle seat. Plus it only printed (worked) one time, I have (worked1), (worked2), (worked3) making sure it works fine, not sure why it isn’t working and what could be the fix for this?

Stored Items

Printed Message

CarsFolder = game.ServerStorage.Cars:GetDescendants()
CarsHasSong = game.ServerStorage.Cars.Car_Items
local SongItems = {CarsHasSong.Song, CarsHasSong.Hit_Song}

for I, CarSeats in pairs(CarsFolder) do
	print("Worked")
	if CarSeats:IsA("VehicleSeat") and CarSeats.HasSong == true then
		print("Worked1")
		local CloneSong = SongItems:Clone()
		print("Worked2")
		CloneSong.Parent = CarSeats
		print("Worked3")
	end
end

Do not write entire scripts or design entire systems.

1 Like

Your calling Clone on the table, not the items in the table.

for _, item in SongItems do
   -- Iterate through the table and clone each item
   item:Clone().Parent = CarSeats
end
1 Like