:Clone does not clone descendants

Hello,
It seems like when I use :Clone() on a BillboardGui it doesn’t clone its children.
The scripts clones a BillboardGui on the client to the workspace, only the client is supposed to see it.

I have tried checking with breakpoints if the children somehow gets deleted after getting cloned, but no it gets cloned without its children.

Archivable is set to true on all children btw.

(PS: check comments with CHECKIT in them.)
Here’s a part of my script:

--CHECKIT// THIS IS A LOCALSCRIPT \\CHECKIT--

-- Modules
local gameModule = require(game:GetService("ReplicatedStorage").GameModule)

-- References
local UserInputService				=	game:GetService("UserInputService")
local LocalPlayer					=	game:GetService("Players").LocalPlayer
local CurrentCamera					=	game.Workspace.CurrentCamera
local selectedBlock: ObjectValue	=	script.Parent.selectedBlock
local BuildGui						=	script.Parent.Parent
local Blocks						=	game:GetService("ReplicatedStorage").Blocks
local LocalBlocks					=	Instance.new("Folder")
local ConfirmUi						=	LocalPlayer.PlayerGui:WaitForChild("ConfirmUi")
local BuildingZones					=	game.Workspace.Platforms.BuildingZones

LocalBlocks.Name	=	"TempLocalBlocks" --CHECKIT// Folder where the Guis are stored in, inside of blocks. \\CHECKIT--
LocalBlocks.Parent	=	game.Workspace

-- Remotes & Bindables
local BuildBlockRemote	=	game:GetService("ReplicatedStorage").Remotes.Building.BuildBlock
local TimeTypeRemote	=	game.ReplicatedStorage.TimeType -- sends TimeType when match starts

-- Variables
local deleteMode = script.Parent.deleteMode

local connections = {
	onConfirmation = {},
	onClick = nil, -- declared at runtime
	onBlockSelected = nil
}

-- CONSTANTS
local LOCAL_BLOCK_TRANSPARENCY = 0.45


-- part of the code
local NewConfirmUi = ConfirmUi:Clone() --CHECKIT// The clone of the Gui \\ CHECKIT--
local LocalBlock = Block:Clone() --CHECKIT// The clone of a Block, which the Gui will be a child of. It only appears on the client. \\ CHECKIT--
LocalBlock.CanTouch = false
LocalBlock.CanQuery = false
LocalBlock.Position = gameModule.snapToGrid(mouseRaycast.Position, mouseRaycast.Normal)
LocalBlock.Transparency = 1
for _, Texture in LocalBlock:GetChildren() do -- makes all of the textures of the block transparent
	if Texture.ClassName == "Texture" then
		Texture.Transparency = LOCAL_BLOCK_TRANSPARENCY
	end
end
NewConfirmUi.Enabled = true --CHECKIT// It's disabled by default so the client doesn't see a Gui at 0, 0, 0 \\CHECKIT--
NewConfirmUi.Parent = LocalBlock
LocalBlock.Parent = LocalBlocks

NewConfirmUi.Frame.Yes.Activated:Once(function() 
	for _, connection in connections.onConfirmation do connection:Disconnect() end
		sendBlock(Block, mousePosition)
		LocalBlock:Destroy()
	end)
NewConfirmUi.Frame.No.Activated:Once(function()
	for _, connection in connections.onConfirmation do connection:Disconnect() end
		LocalBlock:Destroy()
	end)
1 Like

Fixed by moving the Gui to ReplicatedStorage. Might be a Roblox mistake or intended behavior, which is weird.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.