This system is supposed to work but isn't?

So basically I’m making a merge gems game.
It is based on the hit mobile game genre of merging things.
e.g: you start with a, a + a = b, b + b = c, c + c = d, and so on.
Like this except instead of dragging it shows arrows and you click one and then it moves it (haven’t done the moving yet.)

External Media
Heres a link because it keeps breaking:

I want to clone a UI and put it as a child of a model. Simple, right?
Nothing happens, it prints stuff but doesn’t clone the UI at all…

I’ve only tried one thing, which is a script that is supposed to be working.

Here is my code:

MergeSystem (modulescript

-- made by recanman
local merge = {}
local controls = require(script.Controls)

local function showHoverUi(preset, gem)
	local hoverUi = game.ReplicatedStorage.Assets.UI.HoverUI:Clone()
	hoverUi.Parent = gem
        print("hi people") -- this works
	hoverUi.MainFrame.MainText.Text = hoverUi.Presets[preset].Value
	if (preset == "UpArrow") then hoverUi.ExtentsOffset =, 2, 0)
	elseif (preset == "DownArrow") then hoverUi.ExtentsOffset =, -2, 0)
	elseif (preset == "LeftArrow") then hoverUi.ExtentsOffset =, 0, 0)
	elseif (preset == "RightArrow") then hoverUi.ExtentsOffset =, 0, 0)
	else print("Malformed preset.") end

function merge.ShowControls(hole)
	local ui = game.ReplicatedStorage.Assets.UI.HoverUI
	local gem = hole.Parent:FindFirstChildOfClass("Model")
	for name, _ in pairs(controls[hole.Name]) do
		showHoverUi(name .. "Arrow", gem)

return merge

Controls (ModuleScript)

-- made by recanman
local controls = {}

controls.Hole1 = {
	Down = true,
	Left = true
} controls.Hole2 = {
	Down = true,
	Right = true,
	Left = true
} controls.Hole3 = {
	Down = true,
	Right = true,
	Left = true
} controls.Hole4 = {
	Down = true,
	Right = true
} controls.Hole5 = {
	Up = true,
	Left = true
} controls.Hole6 = {
	Up = true,
	Right = true
} controls.Hole7 = {
	Up = true,
	Right = true,
	Left = true
} controls.Hole8 = {
	Up = true,
	Right = true,
	Left = true

return controls

Merge (LocalScript)

-- made by recanman
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local island = game.Workspace:WaitForChild("PlayerFolders"):WaitForChild(plr.Name).Island
local merge = require(game.ReplicatedStorage.Assets.Modules.MergeSystem)
local mtarget
local db

	if (db == true) then wait() else
		db = true
		if (mouse.Target ~= nil) then
			mtarget = mouse.Target
			if (string.lower(mtarget.Name) == "border") then
			db = false

Any help would be appreciated. Thanks!!

Still haven’t gotten an answer. I’ve been stuck for some time, with no solution.

local gem = hole.Parent:FindFirstChildOfClass("Model")

Are sure that this line is returning a non-nil value?

1 Like

I am completely sure this is not returning nil.
print(gem.Name) perfectly returns the gem name. (gem1)

A few questions:

  • What is the class type of gem?
  • Where is gem?
  • Where is the player’s camera?
  • How do you know that the GUI is not being copied?
  • Is the text that you are putting into the GUI non-blank?

The class type is a model.
The gem is in a part named hole1, hole2, hole3 etc (up to 8)
The player camera is not tampered with, free control.
i check in explorer nothing is being happening.
It is blank.

Here is my hierarchy:

Here is the gem spawn script if you were curious:

-- made by recanman
-- NOTE: add support for gamepass x2 speed later (ds2)
-- NOTE: add rebirths where you get tier 2 everytime etc
repeat wait() until (script.Parent.Parent.Parent.Name ~= "ServerStorage")

local function chooseRandomSpawn(gem)
	local holeChosen = math.random(1, #script.Parent.Holes:GetChildren())
	if (script.Parent.Holes:GetChildren()[holeChosen]:FindFirstChildOfClass("Model") == nil) then
		local holeBrickChosen = script.Parent.Holes:GetChildren()[holeChosen]
		gem:SetPrimaryPartCFrame( +, 2, 0)))
		gem.Parent = holeBrickChosen
		return	true
	for counter, child in ipairs(script.Parent.Holes:GetChildren()) do -- haha this time we are using the first variable
		if (child:FindFirstChildOfClass("Model") ~= nil and counter == 8) then
			return true

while (true) do
	repeat local success = chooseRandomSpawn(game.ReplicatedStorage.Assets.Gems.Gem1:Clone()); wait() until success == true

(ignore my little notes at the top)

It looks like you are trying to put a BillboardGui inside a model. I’m not sure if that works.
Have you tried searching the workspace for he object you are cloning?

1 Like

It is in replicatedstorage > Assets > UI > HoverUI

ill try to put it in a part

Aha, looks like i did hole.Parent it is supposed to be just hole.
Thank you for the support!