I'm doing a check to see if someone has a shirt, and if they do clone a gui into the players gui.
but whenever I move it, it deletes the children..
Code
local Player = game.Players.LocalPlayer local Items = {291002383,291002527,291002685,291003057,291004569,342437379} local Owns = function() for i = 1, #Items do if game:GetService("MarketplaceService"):PlayerOwnsAsset(Player, tonumber(Items[i])) then local gui = script.Guis.gui local CGui = gui:Clone() CGui.Parent = Player.PlayerGui print(CGui.Parent) return true end end return false end
11:28:07.711 - Something unexpectedly tried to set the parent of gui to NULL while trying to set the parent of gui. Current parent is PlayerGui.
Help? If you need more of an explanation, please post a comment
Roblox doesn't really like the LocalScripts trying to do stuff that it can't see. One of these issues is trying to parent new Instances from a LocalScript whilst replication is trying to work its way across the server. Result? Chaos.
You should try and wait a bit before moving the stuff into PlayerGui, so that it doesn't flip out. We had a similar problem when working with Valkyrie, so you're not alone. If FE isn't on, I would recommend using it, as it solves a lot of other issues and vulnerabilities when done properly, as well as encouraging good standards.