Hi, thank you for reading. What I'm trying to do here is that after every 10 seconds, a part named "Foil" is spawned into the workspace. The Foil is moved to where the part is. The problem is that at it says
15:23:52.967 - Workspace.Script:9: unexpected symbol near '=='
Material = game.Lighting.Loot:getChildren() while true do print("Spawning") wait(10) for i = 1, #Material do if Material[i] ~= nil then if Material[i]:findFirstChild("Foil") then Material[i]:findFirstChild("Foil"):clone() == Material Part = game.Workspace.Part if Part ~= nil then Material:MoveTo(Part.Position) end end end end end
This is because you're not setting anything to Material, but rather the clone made by the 'Clone' method.
Also, you were trying to parent a Part to a table which isn't possible.
To fix this, simply add the 'Parent' property to show that is where it's location should be:
Material = game.Lighting["Loot"]GetChildren() while true do print("Spawning") wait(10) for i = 1, #Material do if Material[i] and Material[i]:findFirstChild("Foil") then Material[i]["Foil"]:Clone().Parent = workspace Part = workspace:FindFirstChild("Part") if Part then Material:MoveTo(Part.Position) end end end end