I have this script inside of a screen gui in the player, that's supposed to create a bunch of snowflakes while the value is true, which it does correctly, but once it starts cloning snowflakes the gui lags really bad and it shows this error Something unexpectedly tried to set the parent of SnowFlake to NULL while trying to set the parent of SnowFlake. Current parent is SnowFlakeGui.
Can anybody show me what I'm doing wrong?
local snowflake = script.Parent.SnowFlake local generatesnow = game.Players.LocalPlayer.leaderstats.generatesnow while generatesnow.Value == true do wait(math.random(1, 100)/100) snowflake:Clone().Parent = script.Parent end
You will need to state the clone's parent in another line of code, such as:
local copy = snowflake:Clone() copy.Parent = script.Parent