feat: 50 игр на Lua + импорт Roblox для всех + поддержка Lua в плеере #39
@ -132,35 +132,89 @@ end)`,
|
|||||||
// ═══════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════
|
||||||
'platform-jump': {
|
'platform-jump': {
|
||||||
g2_main: `-- === ИГРА «ПРЫГАЙ ПО ПЛАТФОРМАМ» — главный скрипт (Lua) ===
|
g2_main: `-- === ИГРА «ПРЫГАЙ ПО ПЛАТФОРМАМ» — главный скрипт (Lua) ===
|
||||||
|
${SNIPPET_BROADCAST}
|
||||||
|
|
||||||
local Players = game:GetService("Players")
|
local Players = game:GetService("Players")
|
||||||
local RunService = game:GetService("RunService")
|
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()
|
RunService.Heartbeat:Connect(function()
|
||||||
for _, player in ipairs(Players:GetPlayers()) do
|
if won then return end
|
||||||
local char = player.Character
|
local char = player.Character
|
||||||
if char then
|
if not char then return end
|
||||||
local hrp = char:FindFirstChild("HumanoidRootPart")
|
local hrp = char:FindFirstChild("HumanoidRootPart")
|
||||||
if hrp and hrp.Position.Y < -10 then
|
if hrp and hrp.Position.Y < -3 then
|
||||||
-- Респаун
|
|
||||||
player:LoadCharacter()
|
player:LoadCharacter()
|
||||||
print("Упал! Попробуй ещё раз")
|
loseSound:Play()
|
||||||
end
|
local fallGui = Instance.new("ScreenGui", player.PlayerGui)
|
||||||
end
|
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
|
||||||
|
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)`,
|
end)`,
|
||||||
g2_finish: `-- === Скрипт финишной платформы (Lua) ===
|
g2_finish: `-- === Скрипт финиш-зоны (Lua) ===
|
||||||
|
-- Висит на невидимой зоне над зелёной площадкой.
|
||||||
|
-- Игрок встал — его тело внутри зоны — победа.
|
||||||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
local part = script.Parent
|
local part = script.Parent
|
||||||
|
local fired = false
|
||||||
|
|
||||||
part.Touched:Connect(function(hit)
|
part.Touched:Connect(function(hit)
|
||||||
|
if fired then return end
|
||||||
local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
|
local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
|
||||||
if not h then return end
|
if not h then return end
|
||||||
print("ПОБЕДА! Ты допрыгал!")
|
fired = true
|
||||||
-- Заморозить
|
local ev = ReplicatedStorage:FindFirstChild("FinishReached")
|
||||||
h.WalkSpeed = 0
|
if ev then ev:Fire() end
|
||||||
h.JumpPower = 0
|
|
||||||
end)`,
|
end)`,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user