I am cloning a premade frame using a localscript, the script and frame are both in playergui and the frame is visible in explorer when testing on the client and server, yet cloning the frame leads to just the frame being cloned, not it’s children. This breaks my script, what also doesn’t make sense is that this script worked fine in my test place, yet when I bring it over to my game for whatever reason it just stops working.
I’ve checked multiple times if archivable was off for what I was trying to clone and it isn’t, which makes this extremely irritating. I don’t know if this is a bug or if I made a mistake in my code.
local message = messageFrame:Clone()
for i,v in ipairs(messageFrame:GetChildren()) do -- this was added in an attempt to clone through iteration which STILL did not work
if not message:FindFirstChild(v.Name) then
v:Clone().Parent = message
message.Parent = workspace -- parenting it to workspace or anything else changed nothing
hmm. Everything should work then.
How are you defining messageFrame? Maybe there’s another frame with the same name or you are just cloning the frame before the objects inside it are added. I would add a task.wait(2) at the beggining for example just to make sure if the issue really is the script
local uiAssets = game.Players.LocalPlayer.PlayerGui:WaitForChild("guiAssets")
local messageFrame = uiAssets:WaitForChild("messageFrame")
local _message,_pName = messageFrame:WaitForChild("message"), messageFrame:WaitForChild("pName")
I don’t think this is what’s happening because it’s still visible in explorer on server and client side, I’ve checked other scripts but there’s nothing that would delete anything in that folder, and I don’t use third party scripts so I can rule out malicious scripts.
Ok, so your messageFrame template instance appears to have no descendants upon being used. This must mean one of these things here:
The template was destroyed
Somewhere else in your code is modifying this variable
You mentioned this:
Are you ABSOLUTELY sure that the frame you were looking at is actually the template that’s assigned to messageFrame? Try adding an identifiable instance inside of your template as soon as you assign it to messageFrame, and then see if it’s visible under the explorer.
Another thing you can try doing is listening for instance.Destroying on the template, which will tell you when it’s being destroyed (if it’s being destroyed).