I was trying to make if a union reaches 0 on the health bar. It disappears and an old union spawns in.
local ClickDetector = game.Workspace.Union.ClickDetector local Textlabel = game.Workspace.Union.BillboardGui.TextLabel local OldUnion = game.ServerStorage:WaitForChild("OldUnion") local Union = game.Workspace.Union ClickDetector.MouseClick:Connect(function() Textlabel.Text = Textlabel.Text - 10 end) if Textlabel.Text == 0 then Union.Transparency = 1 Union.CanCollide = false Textlabel.TextTransparency = 1 OldUnion.Parent = game.Workspace OldUnion.CFrame = Union.CFrame end
You are trying to minus a number from a string, you gotta make the string a number first,
TextLabel.Text = tonumber(TextLabel.Text) - 10
if tonumber(TextLabel.Text) == 0 then
and it should work as expected.