local folder = game:GetService(“Workspace”).PartsToSpawn:GetChildren()
local CoolMath = math.random(1,#folder)
print(CoolMath)
while true do
CoolMath = math.random(1)
task.wait(3)
if CoolMath == 1 then
for i = 1,1 do
local folderItems = folder
folderItems:GetPivot(CFrame.new(Random.new():NextInteger(-50, 50), Random.new():NextInteger(-50, 50), Random.new():NextInteger(-50, 50)))
folderItems.Parent = folder
end
First thing I’m noticing is that your code could be cleaned up by a lot. The reason it’s throwing that error is because folderItems is a list of all of the children in PartsToSpawn. You have to get a pivot of either a model or a part, you cannot get the pivot of multiple parts with a single function.
Loop through all the items in the table with a for loop
Also, no offense at all, but do you know what you’re writing? You make a random number between 1 and 1, then check if it’s 1, make another random number that’s never used, use a for loop that only runs once, make a variable equal to a previous variable, then switch to using Random.new instead of math.random.
Never Mind I mess up about my coding you are right the script is too messy and I didn’t code it right I wasn’t sure how to make a item spawner % or mins and Thank you for helping me im just going to recode it.
No problem! Glad that was the solution. Again, I didn’t mean any harm with that, I just want to make sure you aren’t copy and pasting from like YouTube tutorials an don’t understanding what you’re writing