Billboard Gui not cloning

I am trying to make a billboard gui that has a button so I put it in player gui. in my script, I’m trying to clone it but it is not doing that and I don’t know what to do.

-- some of the script
function buildings.new(creator: Player, cframe: CFrame)
	return setmetatable({
		creator = creator,
		gui = creator.PlayerGui:WaitForChild("Object Gui"):Clone(), -- not cloning
		model = newModel(logModel, creator.TeamColor.Color, cframe)
	}, buildings)
end

function buildings:init()
	local creator: Player = self.creator
	
	self.gui.Enabled = true
	self.gui.Adornee = self.model.Log
	self.money = 0
	self.gui.Main["Name & money"].Text = string.format("%s's %s that gained $%d", self.creator.Name, self.model:GetAttribute("name"), self.money)
	
	local btn: TextButton = self.gui.Main.Sell
	btn.Text = string.format("Sell for $%d", self.model:GetAttribute("price") * 0.8)
	
	coroutine.wrap(function()
		while task.wait(self.model:GetAttribute("waitTime")) and self.model do
			self:increase()
		end
	end)()
	
	self.gui.Main.Remote.OnServerEvent:Connect(function()
		self:sell()
	end)
	
	print("started")
end

image

on play:
(its not cloning or setting the adornee)

image

there are no errors so im confused and i hope this is enough for someone to help

9 Likes

Where are you parenting the billboard GUI?

3 Likes

its in starter gui, and im setting the adornee to a part

2 Likes

its a local or server script??

1 Like

I think you still need to set a part as the parent of the clone.

1 Like

the script is in serverscriptservice and a local script is in the button so i can click

1 Like

Wel i did it again in the startergui but it didnt work, but if i put the billboard into worspace, it does clone

2 Likes

yes but then I can not click on the button

1 Like

You could use a remote event …

1 Like

Yes i am using a remote event, but how does that relate to this

1 Like

try creator:WaitForChild(“PlayerGui”)

nothing happened + no errors before so couldn’t have been that

Are you sure “creator” is the instance of the player? it could be the name

1 Like

I renamed “creator” to “player” in the module script

here is the server script:

local mod = require(script.Parent.Buildings)

game.Players.PlayerAdded:Connect(function(player)
	local m = mod.new(player, CFrame.new(-10, 0.75, 0))
	
	m:init()
end)
1 Like

Billboard guis are for rendering a 2d image in the 3d workspace environment. If you were to use a screengui you could add it to the player GUI during runtime.
And then the local script and button would work.

2 Likes

are you suggesting using a screengui? or are you saying something else

I’m a little confused as to what specifically you want to achieve.
If you want a billboard to pop up on a part, use a billboardGui and parent it to the part, but scripts will need to be serverside.
If you want a button to appear on the player GUI simply placing a screengui into starter characterscripts will do this when the character loads and run local scripts.
If you want an event to add the button to the player GUI, then clone a screengui from serverstorage/replicated storage to the player GUI, and this will let you use local scripts as soon as it is parented there.

2 Likes

I am trying to make the billboard gui cloned so I can have multiple with the building.new. The reason it is set in the player-gui is so I can have buttons to work (which does not work on places like workspace, because of local scripts only able to be in player-gui, player-tools etc).

1 Like

Ok, thanks, so if you:
Change the billboardgui to a screengui and put it in replicated storage.
When you run building.new clone the screengui and parent it to the player GUI.

This should give you the effect you want. Local scripts will work once cloned and reparented.

if you wanted to have multiple screengui at the same time they would overlap, so might be better to clone a frame and put it into a screengui with preset UI layouts

Thanks, but I still used the billboard gui. I forgot that replicated storage can have both server and client see (and not one or the other)