-- отображение текущих характеристик башни

wait(1)

me = script.Parent
plr = game.Players.LocalPlayer
gui = plr.PlayerGui.ScreenGui.Main.TowerInfo


while true do
	wait()
	
	if me.objTower.Value == nil then
		me.Visible = false
	else
		obj=me.objTower.Value
		
		me.Visible = true
		--		print(obj.Name)
		local val = obj:FindFirstChild("Owner")
		if val then 
			gui.txtOwner.Text	= val.Value
		end
		temp=obj:FindFirstChild("Config")
		if temp ~= nil then	-- не кристалл
			gui.txtDamage.Text	= obj.cfgDamage.Value
			gui.txtSpeed.Text	= obj.cfgSpeedAttack.Value
			-- вывод типа урона
			types = temp.DamageType.Value		
			if types == 1 then
				gui.txtType.Text= "Single"
				gui.txtRadius.Text	= obj.cfgRadius.Value
			elseif types == 2 then
				gui.txtType.Text= "AoE"
				gui.txtRadius.Text	= obj.cfgRadius.Value
			elseif types == 3 then
				gui.txtType.Text= "Contact"
				gui.txtRadius.Text	= " - "
			else
				gui.txtType.Text= " ??? "
			end
		else -- кристалл
			gui.txtDamage.Text	= " - "
			gui.txtRadius.Text	= " - "
			gui.txtSpeed.Text	= " - "
			gui.txtType.Text	= " - "
		end
		
	end
end
