Загрузка данных



local kingdown = true
local position1 = Hill.Position

local function onTouch(part)
	if (kingdown) then
		kingdown = false
		king_name.Value = part.Parent.Name
		Label.Text = "Да здравствует король "..king_name.Value.."!"
		local KING = part.Parent.Humanoid
		
		local player = Players:GetPlayerFromCharacter(part.Parent)
		local leaderstats = player.leaderstats
		local crowns = leaderstats and leaderstats:FindFirstChild("Crowns")
		
		local tool_to_destroy = player.Backpack:FindFirstChild("Tool")
		if tool_to_destroy then
			tool_to_destroy:Destroy()
		end
		tool_to_destroy = KING.Parent:FindFirstChild("Tool")
		if tool_to_destroy then
			tool_to_destroy:Destroy()
		end
		while true do
			wait(1)
			KING.BodyDepthScale.Value += 0.06
			KING.HeadScale.Value += 0.04
			KING.BodyWidthScale.Value += 0.04
			KING.BodyHeightScale.Value += 0.01
			KING.WalkSpeed *=0.99
			
			crowns.Value += 1
			local position2 = part.Position	
			local distance = (position1 - position2).magnitude
			print("distance:",distance)
			if distance > fall_distance then
				king_name.Value = ""
				Label.Text = "Король пал!"
				KING.BodyDepthScale.Value = 1
				KING.HeadScale.Value = 1
				KING.BodyWidthScale.Value = 1
				KING.BodyHeightScale.Value = 1
				KING.WalkSpeed = 16
				kingdown = true
				local return_tool = game.ReplicatedStorage.Tool:Clone()
				return_tool.Parent = KING.Parent
				break
			end
		end
	end
	
end

Hill.Touched:Connect(onTouch)