local v={}v.all={}function v.new(Q,B)local I=newIndicator or{}I.time=3.2*math.max(.24,damagedone/100)or 1 I.position=((humanoid:FindFirstChild("\099\114\101\097\116\111\114")).Value.Character:FindFirstChild("\084\111\114\115\111")).Position or Vector3.new()print(I.position)I.timeCreated=tick()I.timeExpire=tick()+I.time I.alive=true I.frame=frTemplate:clone()I.frame.Parent=gui I.frame.Archivable=false setmetatable(I,v)Q.__index=Q table.insert(v.all,I)I:update()return I end function v.expire(B)B.alive=false B.frame:Destroy()for Q=1,#v.all,1 do if B==v.all[Q]then table.remove(v.all,Q)break end end end function v.setAngle(B,v)if not B.alive then return end local Q=v*(180/math.pi)B.frame.Position=UDim2.new(.5,math.cos(v)*radius+B.frame.AbsoluteSize.X/-2,.5,math.sin(v)*radius+B.frame.AbsoluteSize.Y/-2)B.frame.Rotation=Q+90 end function v.update(v)if tick()>=v.timeExpire then v:expire()else local B=(tick()-v.timeCreated)/v.time v:setAngle((getCameraAngle(camera)-angleBetweenPoints(camera.Focus.p,v.position))-math.pi/2)v.frame.ImageLabel.ImageTransparency=B v.frame.ImageLabel.Size=UDim2.new(0,350,0,350*(1-B))end end function v.updateAll(B)local Q=1 while Q<=#v.all do local B=v.all[Q]B:update()if B.alive then Q=Q+1 end end end


local Indicator = {}
Indicator.all = {}

function Indicator:new(position)
	local newIndicator = newIndicator or {}
	
	-- Properties
	newIndicator.time = (3.2*math.max(0.24,(damagedone/100))) or 1
	newIndicator.position = humanoid:FindFirstChild("creator").Value.Character:FindFirstChild("Torso").Position or Vector3.new()
	print(newIndicator.position)
	newIndicator.timeCreated = tick()
	newIndicator.timeExpire = tick() + newIndicator.time
	newIndicator.alive = true
	
	newIndicator.frame = frTemplate:clone()
	newIndicator.frame.Parent = gui
	newIndicator.frame.Archivable = false
	
	setmetatable(newIndicator, Indicator)
	self.__index = self
	table.insert(Indicator.all, newIndicator)
	
	newIndicator:update()
	
	return newIndicator
end

function Indicator:expire()
	self.alive = false
	
	-- Cleanup resources
	self.frame:Destroy()
	
	-- Remove from all
	for i = 1, #Indicator.all do
		if self == Indicator.all[i] then
			table.remove(Indicator.all, i)
			break
		end
	end
end

function Indicator:setAngle(angleRadians)
	if not self.alive then return end
	
	local angleDegrees = angleRadians * (180 / math.pi)
	self.frame.Position = UDim2.new(
			.5,
			math.cos(angleRadians) * radius + self.frame.AbsoluteSize.X / -2,
			.5,
			math.sin(angleRadians) * radius + self.frame.AbsoluteSize.Y / -2
		)
	self.frame.Rotation = angleDegrees + 90
end

function Indicator:update()
	if tick() >= self.timeExpire then
		self:expire()
	else
		local perc = (tick() - self.timeCreated) / self.time
		self:setAngle(getCameraAngle(camera) - angleBetweenPoints(camera.Focus.p, self.position) - math.pi / 2)

		self.frame.ImageLabel.ImageTransparency = perc
		self.frame.ImageLabel.Size = UDim2.new(0, 350, 0, 350 * (1 - perc))
	end
end

function Indicator:updateAll()
	local i = 1
	while i <= #Indicator.all do
		local indicator = Indicator.all[i]
		indicator:update()
		if indicator.alive then
			i = i + 1
		end
	end
end
