Untitled

 avatar
unknown
lua
6 months ago
1.2 kB
2
Indexable


local h = script.Parent.Humanoid
local lasthp = h.Health

local dps_1 = 0
local dps_2 = 0
local dps_3 = 0

function addCommas(num)
	-- Convert the number to a string
	local str = tostring(num)

	-- Add commas to the string version of the number
	str = str:reverse():gsub("(%d%d%d)", "%1,"):reverse()

	-- Remove any leading comma if present
	if str:sub(1, 1) == "," then
		str = str:sub(2)
	end

	return str
end


game:GetService("RunService").Stepped:Connect(function()
	--if lasthp ~= h.Health then
	local diff = lasthp-h.Health
	local newname = ""

	dps_1+=diff
	dps_2+=diff
	dps_3+=diff

	if diff ~= 0 then
		spawn(function()
			local steps = 30
			for x = 1,steps do
				dps_1-=diff/steps
				task.wait(0.1)
			end
		end)
		spawn(function()
			local steps = 150
			for x = 1,steps do
				dps_2-=diff/steps
				task.wait(0.1)
			end
		end)
		spawn(function()
			local steps = 600
			for x = 1,steps do
				dps_3-=diff/steps
				task.wait(0.1)
			end
		end)
	end

	local a = addCommas(math.floor(dps_1/3))
	local b = addCommas(math.floor(dps_2/15))
	local c = addCommas(math.floor(dps_3/60))

	h.DisplayName = a .. " | " .. b .. " | " .. c
	lasthp = h.Health
	--end
end)
Editor is loading...
Leave a Comment