Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Getting "trying to set locked parent" in console?

Asked by 6 years ago
Edited 6 years ago

What my game does it move a GUI out of ReplicatedStorage to Player's PlayerGui, though when game starts I get the warning once, then the Gui is removed and it appears again.

What's going on here?

Code cloning and setting parent of GUI:

local GUI = game.ReplicatedStorage.Client.Misc.Menu:Clone()
local pg = Player:WaitForChild("PlayerGui")
GUI.Parent = pg

1 answer

Log in to vote
0
Answered by
luachef 61
6 years ago

seems that you :destroy() the gui but then your script tries to set it's parent again (the :Destroy() function locks instance's parent so you can't get access to it anymore)

Ad

Answer this question