diff --git a/src/community/docsGamesBuildersLua.js b/src/community/docsGamesBuildersLua.js index 6cdf886..f9d9692 100644 --- a/src/community/docsGamesBuildersLua.js +++ b/src/community/docsGamesBuildersLua.js @@ -132,35 +132,89 @@ end)`, // ═══════════════════════════════════════════════════════════════ 'platform-jump': { g2_main: `-- === ИГРА «ПРЫГАЙ ПО ПЛАТФОРМАМ» — главный скрипт (Lua) === +${SNIPPET_BROADCAST} + local Players = game:GetService("Players") local RunService = game:GetService("RunService") +local player = Players.LocalPlayer +local won = false -print("Допрыгай до зелёного финиша!") +-- Подсказка по центру (на 3 секунды) +local hintGui = Instance.new("ScreenGui", player.PlayerGui) +hintGui.Name = "Hint" +local hint = Instance.new("TextLabel", hintGui) +hint.Size = UDim2.new(0, 480, 0, 60) +hint.Position = UDim2.new(0.5, -240, 0.3, 0) +hint.BackgroundColor3 = Color3.fromRGB(0, 0, 0) +hint.BackgroundTransparency = 0.4 +hint.TextColor3 = Color3.fromRGB(255, 255, 255) +hint.TextScaled = true +hint.Font = Enum.Font.SourceSansBold +hint.Text = "Допрыгай до зелёной площадки!" +task.delay(3, function() hintGui:Destroy() end) --- Каждый кадр проверяем не упал ли игрок +-- Звуки +local loseSound = Instance.new("Sound", workspace) +loseSound.SoundId = "lose" +loseSound.Volume = 1 +local winSound = Instance.new("Sound", workspace) +winSound.SoundId = "win" +winSound.Volume = 1 + +-- Каждый кадр следим: не упал ли игрок RunService.Heartbeat:Connect(function() - for _, player in ipairs(Players:GetPlayers()) do - local char = player.Character - if char then - local hrp = char:FindFirstChild("HumanoidRootPart") - if hrp and hrp.Position.Y < -10 then - -- Респаун - player:LoadCharacter() - print("Упал! Попробуй ещё раз") - end - end + if won then return end + local char = player.Character + if not char then return end + local hrp = char:FindFirstChild("HumanoidRootPart") + if hrp and hrp.Position.Y < -3 then + player:LoadCharacter() + loseSound:Play() + local fallGui = Instance.new("ScreenGui", player.PlayerGui) + local fallLabel = Instance.new("TextLabel", fallGui) + fallLabel.Size = UDim2.new(0, 400, 0, 60) + fallLabel.Position = UDim2.new(0.5, -200, 0.35, 0) + fallLabel.BackgroundColor3 = Color3.fromRGB(120, 0, 0) + fallLabel.BackgroundTransparency = 0.3 + fallLabel.TextColor3 = Color3.fromRGB(255, 255, 255) + fallLabel.TextScaled = true + fallLabel.Font = Enum.Font.SourceSansBold + fallLabel.Text = "Упал! Пробуй снова." + task.delay(1.5, function() fallGui:Destroy() end) end +end) + +-- Финиш-зона шлёт BindableEvent +local finishEvent = getEvent("FinishReached") +finishEvent.Event:Connect(function() + if won then return end + won = true + winSound:Play() + local winGui = Instance.new("ScreenGui", player.PlayerGui) + local winLabel = Instance.new("TextLabel", winGui) + winLabel.Size = UDim2.new(0, 540, 0, 80) + winLabel.Position = UDim2.new(0.5, -270, 0.4, 0) + winLabel.BackgroundColor3 = Color3.fromRGB(0, 120, 0) + winLabel.BackgroundTransparency = 0.2 + winLabel.TextColor3 = Color3.fromRGB(255, 255, 0) + winLabel.TextScaled = true + winLabel.Font = Enum.Font.SourceSansBold + winLabel.Text = "Победа! Ты дошёл до финиша!" end)`, - g2_finish: `-- === Скрипт финишной платформы (Lua) === + g2_finish: `-- === Скрипт финиш-зоны (Lua) === +-- Висит на невидимой зоне над зелёной площадкой. +-- Игрок встал — его тело внутри зоны — победа. +local ReplicatedStorage = game:GetService("ReplicatedStorage") local part = script.Parent +local fired = false part.Touched:Connect(function(hit) + if fired then return end local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid") if not h then return end - print("ПОБЕДА! Ты допрыгал!") - -- Заморозить - h.WalkSpeed = 0 - h.JumpPower = 0 + fired = true + local ev = ReplicatedStorage:FindFirstChild("FinishReached") + if ev then ev:Fire() end end)`, },