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.