-- Сервисы local TweenService = game:GetService("TweenService") local RunService = game:GetService("RunService") local player = game.Players.LocalPlayer -- Ожидаем персонажа local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") -- Создаём GUI local screenGui = Instance.new("ScreenGui") screenGui.Parent = player:WaitForChild("PlayerGui") -- Основная панель (чуть больше для прогресс-бара) local mainFrame = Instance.new("Frame") mainFrame.Size = UDim2.new(0, 380, 0, 230) mainFrame.Position = UDim2.new(0.5, -190, 0.5, -115) mainFrame.BackgroundColor3 = Color3.new(0.1, 0.1, 0.1) mainFrame.BorderSizePixel = 0 mainFrame.ClipsDescendants = true mainFrame.Parent = screenGui -- Скругление углов local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 20) corner.Parent = mainFrame -- Текстовая метка (информация о шагах, дистанции, уровне и опыте) local textLabel = Instance.new("TextLabel") textLabel.Size = UDim2.new(1, -20, 0, 100) textLabel.Position = UDim2.new(0, 10, 0, 10) textLabel.BackgroundTransparency = 1 textLabel.TextColor3 = Color3.new(1, 1, 1) textLabel.Text = "Шаги: 0\nДистанция: 0.0 м\nКилометры: 0.00 км\nУровень: 1 (EXP: 0 / 64)" textLabel.Font = Enum.Font.SourceSans textLabel.TextSize = 18 textLabel.TextXAlignment = Enum.TextXAlignment.Left textLabel.TextYAlignment = Enum.TextYAlignment.Top textLabel.Parent = mainFrame -- Прогресс-бар (под текстом) local progressBarBg = Instance.new("Frame") progressBarBg.Size = UDim2.new(0.9, 0, 0, 12) progressBarBg.Position = UDim2.new(0.05, 0, 0, 115) progressBarBg.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2) progressBarBg.BorderSizePixel = 0 local bgCorner = Instance.new("UICorner") bgCorner.CornerRadius = UDim.new(0, 6) bgCorner.Parent = progressBarBg progressBarBg.Parent = mainFrame local progressBarFill = Instance.new("Frame") progressBarFill.Size = UDim2.new(0, 0, 1, 0) -- ширина будет меняться progressBarFill.BackgroundColor3 = Color3.new(0.2, 0.6, 1) -- голубой progressBarFill.BorderSizePixel = 0 local fillCorner = Instance.new("UICorner") fillCorner.CornerRadius = UDim.new(0, 6) fillCorner.Parent = progressBarFill progressBarFill.Parent = progressBarBg -- Кнопка закрытия (крестик) local closeButton = Instance.new("TextButton") closeButton.Size = UDim2.new(0, 30, 0, 30) closeButton.Position = UDim2.new(1, -40, 0, 10) closeButton.BackgroundColor3 = Color3.new(0.6, 0.1, 0.1) closeButton.BorderSizePixel = 0 closeButton.Text = "✕" closeButton.TextColor3 = Color3.new(1, 1, 1) closeButton.TextSize = 20 closeButton.Font = Enum.Font.SourceSans local closeCorner = Instance.new("UICorner") closeCorner.CornerRadius = UDim.new(0, 10) closeCorner.Parent = closeButton closeButton.Parent = mainFrame -- Кнопка Сброс (обнуляет шаги и дистанцию, но не уровень/опыт) local resetButton = Instance.new("TextButton") resetButton.Size = UDim2.new(0, 80, 0, 30) resetButton.Position = UDim2.new(1, -90, 1, -40) resetButton.BackgroundColor3 = Color3.new(0.2, 0.4, 0.6) resetButton.BorderSizePixel = 0 resetButton.Text = "Сброс" resetButton.TextColor3 = Color3.new(1, 1, 1) resetButton.TextSize = 16 resetButton.Font = Enum.Font.SourceSans local resetCorner = Instance.new("UICorner") resetCorner.CornerRadius = UDim.new(0, 10) resetCorner.Parent = resetButton resetButton.Parent = mainFrame -- Переменные шагомера local stepCount = 0 local totalDistance = 0 local distanceWalked = 0 local stepLength = 0.7 local lastPosition = character.PrimaryPart.Position local isMoving = false local STUD_TO_METER = 1 -- можно 0.28 для реальных метров -- Переменные уровней local level = 1 local exp = 0 local expToNext = 64 -- для 1 уровня -- Состояние открытости local isOpen = true -- Функция сокращения чисел (K, M, B, T) local function abbreviateNumber(num) if num < 1000 then return string.format("%.1f", num) elseif num < 1e6 then return string.format("%.1fK", num / 1000) elseif num < 1e9 then return string.format("%.1fM", num / 1e6) elseif num < 1e12 then return string.format("%.1fB", num / 1e9) else return string.format("%.1fT", num / 1e12) end end -- Обновление интерфейса local function updateDisplay() local meters = totalDistance * STUD_TO_METER local kilometers = meters / 1000 -- Обновляем текст textLabel.Text = string.format( "Шаги: %d\nДистанция: %s м\nКилометры: %s км\nУровень: %d (EXP: %d / %d)", stepCount, abbreviateNumber(meters), abbreviateNumber(kilometers), level, exp, expToNext ) -- Обновляем прогресс-бар local progress = math.clamp(exp / expToNext, 0, 1) progressBarFill.Size = UDim2.new(progress, 0, 1, 0) end -- Проверка повышения уровня local function checkLevelUp() while exp >= expToNext do exp = exp - expToNext level = level + 1 expToNext = level * 64 -- следующий уровень требует 64 * новый_уровень end updateDisplay() end -- Начисление опыта за шаг (вызывается при засчитывании шага) local function addExp(amount) exp = exp + amount checkLevelUp() end -- Анимация появления local function animateOpen() mainFrame.Size = UDim2.new(0, 0, 0, 0) mainFrame.Position = UDim2.new(0.5, 0, 0.5, 0) mainFrame.BackgroundTransparency = 1 mainFrame.Visible = true local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out) local sizeGoal = {Size = UDim2.new(0, 380, 0, 230)} local posGoal = {Position = UDim2.new(0.5, -190, 0.5, -115)} local transGoal = {BackgroundTransparency = 0} TweenService:Create(mainFrame, tweenInfo, sizeGoal):Play() TweenService:Create(mainFrame, tweenInfo, posGoal):Play() TweenService:Create(mainFrame, tweenInfo, transGoal):Play() end -- Анимация закрытия local function animateClose() local tweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.In) local sizeGoal = {Size = UDim2.new(0, 0, 0, 0)} local posGoal = {Position = UDim2.new(0.5, 0, 0.5, 0)} local transGoal = {BackgroundTransparency = 1} TweenService:Create(mainFrame, tweenInfo, sizeGoal):Play() TweenService:Create(mainFrame, tweenInfo, posGoal):Play() local transTween = TweenService:Create(mainFrame, tweenInfo, transGoal) transTween:Play() transTween.Completed:Connect(function() mainFrame.Visible = false end) end -- Обработка кнопки закрытия closeButton.MouseButton1Click:Connect(function() if isOpen then isOpen = false animateClose() end end) -- Обработка сброса (обнуляем шаги и дистанцию, уровень и опыт не трогаем) resetButton.MouseButton1Click:Connect(function() stepCount = 0 totalDistance = 0 distanceWalked = 0 updateDisplay() end) -- Основной цикл подсчёта (RenderStepped) local function onRenderStep() if not character or not character.PrimaryPart then return end local currentPos = character.PrimaryPart.Position local delta = (currentPos - lastPosition).Magnitude if isMoving then totalDistance = totalDistance + delta distanceWalked = distanceWalked + delta if distanceWalked >= stepLength then stepCount = stepCount + 1 distanceWalked = distanceWalked - stepLength -- Начисляем опыт за каждый шаг (например, 1 EXP) addExp(1) end updateDisplay() else distanceWalked = 0 end lastPosition = currentPos end -- Отслеживание движения humanoid.Running:Connect(function(speed) isMoving = speed > 0 end) -- Подписка на каждый кадр RunService.RenderStepped:Connect(onRenderStep) -- Запуск animateOpen() updateDisplay() -- Обработка респавна (сохраняем уровень, опыт, шаги и дистанцию) player.CharacterAdded:Connect(function(newCharacter) character = newCharacter humanoid = character:WaitForChild("Humanoid") lastPosition = character.PrimaryPart.Position distanceWalked = 0 -- обнуляем накопление, но шаги и дистанция сохраняются if isOpen then mainFrame.Visible = true animateOpen() end updateDisplay() humanoid.Running:Connect(function(speed) isMoving = speed > 0 end) end)