THIS QUESTION HAS BEEN SOLVED
Information:
Script:
while true do local c = game.Workspace.Coins:FindFirstChild("Coin") if not c then wait() for i,coin in pairs(game.ReplicatedStorage.Coins:GetChildren()) do local clone = coin:Clone() clone.Parent = game.Workspace.Coins end end end
Same concept as the other answer, but here is an even simpler way to do this (I also would not recommend while true loops, but for some things it's ok):
while wait() do --just have the wait in the condition and it will wait then loop. Its quick and easy while also not breaking anything. local c = game.Workspace.Coins:FindFirstChild("Coin") if not c then for i,coin in pairs(game.ReplicatedStorage.Coins:GetChildren()) do local clone = coin:Clone() clone.Parent = game.Workspace.Coins end end end
You need to add a wait() so that your script does't get over whelmed. Basically your code is running too many times a second, and this causes an error so that Roblox Studio doesn't crash. Even if it is a 0.5 second wait that will stop your code from running hundreds of times ever second. Here is what your code should look like now:
while true do local c = game.Workspace.Coins:FindFirstChild("Coin") if not c then wait() for i,coin in pairs(game.ReplicatedStorage.Coins:GetChildren()) do local clone = coin:Clone() wait(--time to wait) clone.Parent = game.Workspace.Coins end end end
If this does help you make sure to accept my answer. Good luck with your project.