local x={}x.all={}function x.new(J,N)local T=N or{}T.time=T.time or 1 T.position=T.position or Vector3.new()T.timeCreated=tick()T.timeExpire=tick()+T.time T.alive=true T.frame=frTemplate:clone()T.frame.Parent=gui T.frame.Archivable=false setmetatable(T,x)J.__index=J table.insert(x.all,T)T:update()return T end function x.expire(N)N.alive=false N.frame:Destroy()for J=1,#x.all,1 do if N==x.all[J]then table.remove(x.all,J)break end end end function x.setAngle(N,x)assert(N,"\117\115\101 \099\111\108\111\110")if not N.alive then return end local J=x*(180/math.pi)N.frame.Position=UDim2.new(.5,math.cos(x)*radius+N.frame.AbsoluteSize.X/-2,.5,math.sin(x)*radius+N.frame.AbsoluteSize.Y/-2)N.frame.Rotation=J+90 end function x.update(x)if tick()>=x.timeExpire then x:expire()else local N=(tick()-x.timeCreated)/x.time x:setAngle((getCameraAngle(camera)-angleBetweenPoints(camera.Focus.p,x.position))-math.pi/2)x.frame.ImageLabel.ImageTransparency=N x.frame.ImageLabel.Size=UDim2.new(0,50,0,-50*(1-N))end end function x.updateAll(N)local J=1 while J<=#x.all do local N=x.all[J]N:update()if N.alive then J=J+1 end end end


local Indicator = {}
Indicator.all = {}

function Indicator:new(newIndicator)
	local newIndicator = newIndicator or {}
	
	-- Properties
	newIndicator.time = newIndicator.time or 1
	newIndicator.position = newIndicator.position or Vector3.new()
	
	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)
	assert(self, "use colon")
	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, 50, 0, -50 * (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
