My text label for my GUI is a damage indicator. I made a damage indicator everything is working fine but the numbers are like 02 instead of 20. Can someone help me fix it.

My code:

--Indicator from 2017. ( Edited for AbsoluteRightful ) Created by XxWingKing


local function TweenOut(Obj,properties)
	local TS = game:GetService("TweenService")
	local TI = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out)
	local Tween = TS:Create(Obj,TI,properties)
	Tween:Play()
end

function Track(Humanoid)
	local Last = Humanoid.Health
	local function HealthChanged(Left)
		if Left < Last then
			local Part = Humanoid.Parent:FindFirstChildWhichIsA("BasePart")
			if Part then
				local EffectPart = Instance.new("Part",script)
				EffectPart.Name = "Effect"
				EffectPart.Size = Vector3.new(0, 0, 0)
				EffectPart.CFrame = Part.CFrame + Vector3.new(math.random(-5,5),math.random(3,5),math.random(-5,5))
				EffectPart.Anchored = true
				EffectPart.CanCollide = false
				EffectPart.Transparency = 1
				local BillboardGui = Instance.new("BillboardGui")
				BillboardGui.Size = UDim2.new(3, 0, 3, 0)
				BillboardGui.Adornee = EffectPart
				BillboardGui.AlwaysOnTop = true
				local TextLabel = Instance.new("TextLabel")
				TextLabel.BackgroundTransparency = 1
				TextLabel.Size = UDim2.new(1, 0, 1, 0)
				TextLabel.TextColor3 = Color3.new(255,0,0)
				local UseText = ""
				local DamageDone = math.floor(Last - Left)
				if DamageDone ~= math.huge then
					if DamageDone < 100001 then
						local Text = tostring(DamageDone)
						local Length = string.len(Text)
						--TextLabel.Rotation = 180
						for i = 1,Length do
 		   					if string.sub(Text,i,i) == "1" then
								UseText = "1"..UseText
							elseif string.sub(Text,i,i) == "2" then
								UseText = "2"..UseText
							elseif string.sub(Text,i,i) == "3" then
								UseText = "3"..UseText
							elseif string.sub(Text,i,i) == "4" then
								UseText = "4"..UseText
							elseif string.sub(Text,i,i) == "5" then
								UseText = "5"..UseText
								elseif string.sub(Text,i,i) == "6" then
								UseText = "6"..UseText
							elseif string.sub(Text,i,i) == "7" then
								UseText = "7"..UseText
							elseif string.sub(Text,i,i) == "8" then
								UseText = "8"..UseText
							elseif string.sub(Text,i,i) == "9" then
								UseText = "9"..UseText
							elseif string.sub(Text,i,i) == "0" then
								UseText = "0"..UseText
							end
						end
					else
						UseText = "OVERLOAD"
					end
				else
					UseText = "inf"
				end
				TextLabel.Text = UseText
				TextLabel.TextColor3 = Color3.new(255,0,0)
				TextLabel.TextScaled = true
				TextLabel.Font = Enum.Font.Arial
				TextLabel.Parent = BillboardGui
				BillboardGui.Parent = EffectPart
				Last = Left
				wait(0.5)
				if EffectPart then
					TweenOut(BillboardGui,{Size = UDim2.new(0,0,0,0),StudsOffset = Vector3.new(0,0,0)})
				end
			end
		else
			Last = Left
		end
	end
	Humanoid.HealthChanged:connect(HealthChanged)
end

local D = game.Workspace:GetDescendants()
for i = 1,#D do
	if D[i]:IsA("Humanoid") then
		Track(D[i])
	end
end
function Added(item)
	if item:IsA("Humanoid") then
		Track(item)
	end
end
game.Workspace.DescendantAdded:connect(Added)


2 comments

0

After testing your script, all you need to change is line 68 to "TextLabel.Text = UseText:reverse()"

0

ThanK YOU SO MUCH!! IT WORKED