How do I make a model that infinitely clones itself

I want to make a game where you can mow grass forever, like one of those simulator games.

The grass is a model that’s supposed to regenerate using the clone() thing but it’s only regenerating once.

I have tried putting the clone thing more than once but that doesn’t seem to work. I have also been looking on the internet but can’t find a solution for it either.

1 Like

you can make it clone infinitely by

while wait() do
   yourgrassmodel:Clone().Parent=workspace
end
local model = nil

while wait() do model:Clone() end

you dont have a wait which will end up breaking

1 Like

Thanks, I will test this and see if it works.

i forgot lol… thanks for saving me

Have you tried using loops? You can even put wait(x) somewhere to make it wait a bit before running the code in a loop again.

I have been using while loops but that doesn’t seem to work.

Can you describe what you’re even trying to do? It could help us to tell you what to do.

if you wanna clone it specific number

local howManyTimesWannaClone=YourNumber
for i=1,howManyTimesWannaClone do
   YourGrassModel:Clone().Parent=workspace
end
1 Like

what does your code look like?

I am trying to make a game where you are using a lawn mower to mow grass and i’m trying to make a system where when all the grass is gone it regenerates. I’m not that advanced in coding however so I just used a wall to make it so that the grass regenerates.

This made my roblox studio crash.

you need to add position to your grass models as when you clone they stay in the same position unless you change them

cuz if you look in explorer they should clone

ok lemme see
you can do

for i,v in pairs(workspace:GetChildren()) do
   if v <= 10 then
      for i=1,5 do
         grassmodel:Clone().Parent=workspace
      end
   end
end 

oops this wont work

Here is my code

local clone = game.Workspace.Grass:Clone()

clone.Parent = game.ReplicatedStorage

game.Workspace.Wall.Touched:Connect(function(touch)
if touch then
clone.Parent = workspace
end
end)

why do you clone the grass and then put it in rep storage then put it back in workspace?
because you can just put the grass in the rep storage then clone it when it gets touched

yea you gotta make sure to change the model’s position

also you should add local clone inside of the touched function