Billboard GUI problems

I am trying to make a billboard gui show for the local player by a click detector and a local script.
Code:

local player = game.Players.LocalPlayer
local Data1 = player:WaitForChild("Data1")
local Data2 = player:WaitForChild("Data2")
local Uncooked = Data1:WaitForChild("UncookedChiikens")
local Multiplier = Data2:WaitForChild("Multiplier")

local pos = 30
local neg = -30
script.Parent.MouseClick:Connect(function(player)
	print("clicked")
	script.Parent = script.Parent.Parent
	script.Parent.ClickDetector:Destroy()
	script.Parent.Deletion:Destroy()
	
	local newbillboard = Instance.new("BillboardGui")
	local textlabel = Instance.new("TextLabel")
	newbillboard.Parent = script.Parent
	textlabel.Parent = newbillboard
	newbillboard.AlwaysOnTop = true
	
	script.Parent.Transparency = 1
	
	textlabel.BackgroundTransparency = 1
	textlabel.TextSize = 22
	textlabel.Text = "+1"
	textlabel.FontFace = "Arial"
	textlabel.TextColor3 = Color3.new(1, 0, 0.0156863)
	
	Uncooked.Value += 1 * Multiplier.Value
	textlabel.Visible = true
	textlabel.Text = "+"..1 * Multiplier.Value
	--repeat--
	wait(0.2)
	textlabel.Rotation = pos
	wait(0.2)
	textlabel.Rotation = neg
	wait(0.2)
	textlabel.Rotation = pos
	wait(0.2)
	textlabel.Rotation = neg
	wait(0.2)
	textlabel.Rotation = pos
	wait(0.2)
	textlabel.Rotation = neg
	wait(0.2)
	textlabel.Rotation = pos
	wait(0.2)
	textlabel.Rotation = neg
	wait(0.2)
	textlabel.Rotation = pos
	wait(0.2)
	textlabel.Rotation = neg
	wait(0.2)
	textlabel.Rotation = pos
	wait(0.2)
	textlabel.Rotation = neg
	wait(0.2)
	textlabel.Rotation = pos
	wait(0.2)
	textlabel.Rotation = neg
	--end repeat--
	textlabel.Visible = false
	script.Parent:Destroy()
end)

Whenever I click on the object, nothing prints out. I tried to think of ideas to work around this but I am not sure how.

1 Like

GuiButton’s don’t need a ClickDetector to work. Use MouseButton1Click on GuiButtons instead. Also, make sure the BillboardGui is parented to the player’s PlayerGui, and then you can set the Adornee property to the part you want it to be attached to.

1 Like

Firstly, I am not using a GUI button, I’m using a click detector because the player must click on the part in order for the billboard GUI to work.
Secondly, when I parent the Billboard to the Player’s GUI & set the part as it’s adornee, it still does not work

1 Like