Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Keep getting warnings while trying to set parent?

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

6 comments

0

try setting it to snowflake.Parent, I don't think that will help but try.

0

no luck, thanks for trying to help tho

0

Can you write the tree of that script? ex: ScreenGui -> Frame -> Snowflake & Script

0

StarterGui -> ScreenGui - > Script & SnowFlake

0

Very weird, I made the same setup and made an int value with the same name and it works. Sorry, but I can't help:C

0

That's alright, thanks for trying!

1 answer

You will need to state the clone's parent in another line of code, such as:

local copy = snowflake:Clone()
copy.Parent = script.Parent

5 comments

0

I also tried that, and it still gives me the same error

0

Oh sorry, the - is supposed to be a "="

0

There it should be good

0

It still shows the same error as what I originally used

0

Ok

This discussion is preserved as it was. New answers, comments, and votes are closed.