- 📅 2026-10-09T15:10:42.944Z
- 👁️ 58 katselukertaa
- 🔓 Julkinen
-- LocalScript: Main Game Hub & 6 Mini Games (Termasuk Escape the Maze)
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
-- Data Pencapaian (Achievements)
local Achievements = {
["Clicker"] = { Title = "Klik Master", Desc = "Capai 50 Klik!", Achieved = false, Target = 50, Progress = 0 },
["Dodge"] = { Title = "Raja Gesit", Desc = "Bertahan selama 15 detik!", Achieved = false, Target = 15, Progress = 0 },
["Math"] = { Title = "Otak Enstein", Desc = "Jawab 5 soal dengan benar!", Achieved = false, Target = 5, Progress = 0 },
["Color"] = { Title = "Mata Elang", Desc = "Tebak warna 5 kali!", Achieved = false, Target = 5, Progress = 0 },
["Reaction"] = { Title = "Refleks Kilat", Desc = "Reaksi di bawah 0.3 detik!", Achieved = false, Target = 1, Progress = 0 },
["Maze"] = { Title = "Master Labirin", Desc = "Berhasil kabur dari labirin!", Achieved = false, Target = 1, Progress = 0 }
}
-- ScreenGui Utama
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "MiniGameHubGui"
screenGui.ResetOnSpawn = false
screenGui.Parent = playerGui
-- Frame Utama
local mainFrame = Instance.new("Frame")
mainFrame.Name = "MainFrame"
mainFrame.Size = UDim2.new(0, 500, 0, 380)
mainFrame.Position = UDim2.new(0.5, -250, 0.5, -190)
mainFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
mainFrame.BorderSizePixel = 0
mainFrame.Active = true
mainFrame.Draggable = true
mainFrame.Parent = screenGui
local mainCorner = Instance.new("UICorner")
mainCorner.CornerRadius = UDim.new(0, 16)
mainCorner.Parent = mainFrame
local mainGradient = Instance.new("UIGradient")
mainGradient.Color = ColorSequence.new{
ColorSequenceKeypoint.new(0, Color3.fromRGB(35, 37, 55)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(15, 15, 26))
}
mainGradient.Rotation = 45
mainGradient.Parent = mainFrame
-- Title Bar
local titleLabel = Instance.new("TextLabel")
titleLabel.Size = UDim2.new(0, 280, 0, 40)
titleLabel.Position = UDim2.new(0, 20, 0, 10)
titleLabel.BackgroundTransparency = 1
titleLabel.Text = "🎮 MINI GAME HUB"
titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
titleLabel.TextSize = 20
titleLabel.Font = Enum.Font.FredokaOne
titleLabel.TextXAlignment = Enum.TextXAlignment.Left
titleLabel.Parent = mainFrame
-- Tombol Close (Tutup Total)
local closeBtn = Instance.new("TextButton")
closeBtn.Size = UDim2.new(0, 30, 0, 30)
closeBtn.Position = UDim2.new(1, -40, 0, 10)
closeBtn.BackgroundColor3 = Color3.fromRGB(235, 65, 65)
closeBtn.Text = "✕"
closeBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
closeBtn.TextSize = 16
closeBtn.Font = Enum.Font.GothamBold
closeBtn.Parent = mainFrame
local closeCorner = Instance.new("UICorner")
closeCorner.CornerRadius = UDim.new(0, 8)
closeCorner.Parent = closeBtn
-- Tombol Hide/Minimize
local hideBtn = Instance.new("TextButton")
hideBtn.Size = UDim2.new(0, 30, 0, 30)
hideBtn.Position = UDim2.new(1, -75, 0, 10)
hideBtn.BackgroundColor3 = Color3.fromRGB(70, 75, 95)
hideBtn.Text = "—"
hideBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
hideBtn.TextSize = 16
hideBtn.Font = Enum.Font.GothamBold
hideBtn.Parent = mainFrame
local hideCorner = Instance.new("UICorner")
hideCorner.CornerRadius = UDim.new(0, 8)
hideCorner.Parent = hideBtn
-- Tombol Buka (Open Button saat Gui di-hide)
local openBtn = Instance.new("TextButton")
openBtn.Size = UDim2.new(0, 110, 0, 40)
openBtn.Position = UDim2.new(0, 15, 0.5, -20)
openBtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
openBtn.Text = "🎮 GAME HUB"
openBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
openBtn.TextSize = 13
openBtn.Font = Enum.Font.GothamBold
openBtn.Visible = false
openBtn.Parent = screenGui
local openCorner = Instance.new("UICorner")
openCorner.CornerRadius = UDim.new(0, 10)
openCorner.Parent = openBtn
local openGradient = Instance.new("UIGradient")
openGradient.Color = ColorSequence.new{
ColorSequenceKeypoint.new(0, Color3.fromRGB(110, 60, 235)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(235, 80, 150))
}
openGradient.Parent = openBtn
-- Container Halaman Utama Menu
local menuContainer = Instance.new("Frame")
menuContainer.Size = UDim2.new(1, -40, 1, -70)
menuContainer.Position = UDim2.new(0, 20, 0, 55)
menuContainer.BackgroundTransparency = 1
menuContainer.Parent = mainFrame
-- Container Area Game
local gameContainer = Instance.new("Frame")
gameContainer.Size = UDim2.new(1, -40, 1, -70)
gameContainer.Position = UDim2.new(0, 20, 0, 55)
gameContainer.BackgroundTransparency = 1
gameContainer.Visible = false
gameContainer.Parent = mainFrame
local activeConnections = {}
-- Fungsi Pencapaian Notifikasi
local function triggerAchievement(key)
local ach = Achievements[key]
if ach and not ach.Achieved then
ach.Achieved = true
local pop = Instance.new("Frame")
pop.Size = UDim2.new(0, 260, 0, 55)
pop.Position = UDim2.new(0.5, -130, 0, -70)
pop.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
pop.BorderSizePixel = 0
pop.Parent = screenGui
local popCorner = Instance.new("UICorner")
popCorner.CornerRadius = UDim.new(0, 10)
popCorner.Parent = pop
local popGrad = Instance.new("UIGradient")
popGrad.Color = ColorSequence.new{
ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 180, 50)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(255, 110, 30))
}
popGrad.Parent = pop
local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, -20, 0, 22)
title.Position = UDim2.new(0, 10, 0, 6)
title.BackgroundTransparency = 1
title.Text = "🏆 PENCAPAIAN TERBUKA!"
title.TextColor3 = Color3.fromRGB(255, 255, 255)
title.Font = Enum.Font.GothamBold
title.TextSize = 12
title.Parent = pop
local desc = Instance.new("TextLabel")
desc.Size = UDim2.new(1, -20, 0, 20)
desc.Position = UDim2.new(0, 10, 0, 28)
desc.BackgroundTransparency = 1
desc.Text = ach.Title .. ": " .. ach.Desc
desc.TextColor3 = Color3.fromRGB(255, 240, 220)
desc.Font = Enum.Font.Gotham
desc.TextSize = 11
desc.Parent = pop
pop:TweenPosition(UDim2.new(0.5, -130, 0, 20), "Out", "Quad", 0.4, true)
task.wait(3)
pop:TweenPosition(UDim2.new(0.5, -130, 0, -80), "In", "Quad", 0.4, true, function()
pop:Destroy()
end)
end
end
-- Clear Semua Game & Koneksi Keyboard/Mouse Event
local function clearGameContainer()
for _, conn in ipairs(activeConnections) do
if conn then conn:Disconnect() end
end
table.clear(activeConnections)
for _, v in pairs(gameContainer:GetChildren()) do
v:Destroy()
end
end
local function showMenu()
clearGameContainer()
gameContainer.Visible = false
menuContainer.Visible = true
titleLabel.Text = "🎮 MINI GAME HUB"
end
-- Tombol Keluar dari Game Aktif ke Menu Utama
local function addBackButton()
local back = Instance.new("TextButton")
back.Size = UDim2.new(0, 110, 0, 28)
back.Position = UDim2.new(0, 0, 0, 0)
back.BackgroundColor3 = Color3.fromRGB(220, 65, 65)
back.Text = "🚪 Keluar Game"
back.TextColor3 = Color3.fromRGB(255, 255, 255)
back.Font = Enum.Font.GothamBold
back.TextSize = 11
back.Parent = gameContainer
local c = Instance.new("UICorner")
c.CornerRadius = UDim.new(0, 6)
c.Parent = back
back.MouseButton1Click:Connect(showMenu)
end
-- Helper Pembuat Card Game di Menu
local function createGameCard(name, desc, color1, color2, pos, callback)
local card = Instance.new("TextButton")
card.Size = UDim2.new(0, 140, 0, 110)
card.Position = pos
card.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
card.Text = ""
card.AutoButtonColor = false
card.Parent = menuContainer
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 12)
corner.Parent = card
local grad = Instance.new("UIGradient")
grad.Color = ColorSequence.new{
ColorSequenceKeypoint.new(0, color1),
ColorSequenceKeypoint.new(1, color2)
}
grad.Rotation = 45
grad.Parent = card
local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, -16, 0, 30)
title.Position = UDim2.new(0, 8, 0, 12)
title.BackgroundTransparency = 1
title.Text = name
title.TextColor3 = Color3.fromRGB(255, 255, 255)
title.Font = Enum.Font.GothamBold
title.TextSize = 13
title.TextWrapped = true
title.Parent = card
local sub = Instance.new("TextLabel")
sub.Size = UDim2.new(1, -16, 0, 40)
sub.Position = UDim2.new(0, 8, 0, 45)
sub.BackgroundTransparency = 1
sub.Text = desc
sub.TextColor3 = Color3.fromRGB(230, 230, 250)
sub.Font = Enum.Font.Gotham
sub.TextSize = 10
sub.TextWrapped = true
sub.Parent = card
card.MouseButton1Click:Connect(callback)
end
---------------------------------------------------------
-- MINI GAME 1: Speed Clicker
---------------------------------------------------------
local function loadGame1()
menuContainer.Visible = false
gameContainer.Visible = true
titleLabel.Text = "⚡ Speed Clicker"
addBackButton()
local clicks = 0
local countLbl = Instance.new("TextLabel")
countLbl.Size = UDim2.new(1, 0, 0, 50)
countLbl.Position = UDim2.new(0, 0, 0, 40)
countLbl.BackgroundTransparency = 1
countLbl.Text = "Klik: 0"
countLbl.TextColor3 = Color3.fromRGB(255, 255, 255)
countLbl.Font = Enum.Font.FredokaOne
countLbl.TextSize = 28
countLbl.Parent = gameContainer
local clickBtn = Instance.new("TextButton")
clickBtn.Size = UDim2.new(0, 160, 0, 110)
clickBtn.Position = UDim2.new(0.5, -80, 0, 105)
clickBtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
clickBtn.Text = "KLIK AKU!"
clickBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
clickBtn.Font = Enum.Font.GothamBlack
clickBtn.TextSize = 18
clickBtn.Parent = gameContainer
local c = Instance.new("UICorner")
c.CornerRadius = UDim.new(0, 16)
c.Parent = clickBtn
local g = Instance.new("UIGradient")
g.Color = ColorSequence.new{
ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 90, 90)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(255, 150, 50))
}
g.Parent = clickBtn
clickBtn.MouseButton1Click:Connect(function()
clicks = clicks + 1
countLbl.Text = "Klik: " .. clicks
if clicks >= Achievements["Clicker"].Target then
triggerAchievement("Clicker")
end
end)
end
---------------------------------------------------------
-- MINI GAME 2: Dodge Block
---------------------------------------------------------
local function loadGame2()
menuContainer.Visible = false
gameContainer.Visible = true
titleLabel.Text = "🛡️ Dodge Block"
addBackButton()
local score = 0
local isPlaying = true
local arena = Instance.new("Frame")
arena.Size = UDim2.new(0, 260, 0, 180)
arena.Position = UDim2.new(0.5, -130, 0, 35)
arena.BackgroundColor3 = Color3.fromRGB(20, 22, 32)
arena.ClipsDescendants = true
arena.Parent = gameContainer
local ac = Instance.new("UICorner")
ac.CornerRadius = UDim.new(0, 8)
ac.Parent = arena
local playerBox = Instance.new("Frame")
playerBox.Size = UDim2.new(0, 24, 0, 24)
playerBox.Position = UDim2.new(0.5, -12, 1, -30)
playerBox.BackgroundColor3 = Color3.fromRGB(80, 220, 120)
playerBox.Parent = arena
local scoreLbl = Instance.new("TextLabel")
scoreLbl.Size = UDim2.new(1, 0, 0, 20)
scoreLbl.Position = UDim2.new(0, 0, 0, 220)
scoreLbl.BackgroundTransparency = 1
scoreLbl.Text = "Waktu: 0s"
scoreLbl.TextColor3 = Color3.fromRGB(255, 255, 255)
scoreLbl.Font = Enum.Font.GothamBold
scoreLbl.TextSize = 14
scoreLbl.Parent = gameContainer
local mouseConn = UserInputService.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
local relX = input.Position.X - arena.AbsolutePosition.X
relX = math.clamp(relX, 12, arena.AbsoluteSize.X - 12)
playerBox.Position = UDim2.new(0, relX - 12, 1, -30)
end
end)
table.insert(activeConnections, mouseConn)
task.spawn(function()
while isPlaying and gameContainer.Parent and gameContainer.Visible do
task.wait(1)
if not isPlaying then break end
score = score + 1
scoreLbl.Text = "Waktu: " .. score .. "s"
if score >= Achievements["Dodge"].Target then
triggerAchievement("Dodge")
end
end
end)
task.spawn(function()
while isPlaying and gameContainer.Parent and gameContainer.Visible do
task.wait(0.6)
if not isPlaying then break end
local enemy = Instance.new("Frame")
enemy.Size = UDim2.new(0, 20, 0, 20)
enemy.Position = UDim2.new(0, math.random(0, 240), 0, -20)
enemy.BackgroundColor3 = Color3.fromRGB(245, 75, 75)
enemy.Parent = arena
local tween = TweenService:Create(enemy, TweenInfo.new(1.8, Enum.EasingStyle.Linear), {Position = UDim2.new(enemy.Position.X.Scale, enemy.Position.X.Offset, 1, 20)})
tween:Play()
task.spawn(function()
while enemy.Parent and isPlaying do
task.wait(0.05)
local pPos = playerBox.AbsolutePosition
local ePos = enemy.AbsolutePosition
if math.abs(pPos.X - ePos.X) < 18 and math.abs(pPos.Y - ePos.Y) < 18 then
isPlaying = false
scoreLbl.Text = "Game Over! Skor: " .. score .. "s"
end
end
end)
tween.Completed:Connect(function()
enemy:Destroy()
end)
end
end)
end
---------------------------------------------------------
-- MINI GAME 3: Fast Math
---------------------------------------------------------
local function loadGame3()
menuContainer.Visible = false
gameContainer.Visible = true
titleLabel.Text = "🧮 Fast Math"
addBackButton()
local correctAnswers = 0
local currentAns = 0
local questionLbl = Instance.new("TextLabel")
questionLbl.Size = UDim2.new(1, 0, 0, 40)
questionLbl.Position = UDim2.new(0, 0, 0, 35)
questionLbl.BackgroundTransparency = 1
questionLbl.Text = "2 + 2 = ?"
questionLbl.TextColor3 = Color3.fromRGB(255, 255, 255)
questionLbl.Font = Enum.Font.FredokaOne
questionLbl.TextSize = 26
questionLbl.Parent = gameContainer
local scoreLbl = Instance.new("TextLabel")
scoreLbl.Size = UDim2.new(1, 0, 0, 20)
scoreLbl.Position = UDim2.new(0, 0, 0, 75)
scoreLbl.BackgroundTransparency = 1
scoreLbl.Text = "Benar: 0"
scoreLbl.TextColor3 = Color3.fromRGB(200, 220, 255)
scoreLbl.Font = Enum.Font.Gotham
scoreLbl.TextSize = 13
scoreLbl.Parent = gameContainer
local container = Instance.new("Frame")
container.Size = UDim2.new(0, 300, 0, 120)
container.Position = UDim2.new(0.5, -150, 0, 105)
container.BackgroundTransparency = 1
container.Parent = gameContainer
local function generateQuestion()
local a = math.random(1, 20)
local b = math.random(1, 20)
currentAns = a + b
questionLbl.Text = a .. " + " .. b .. " = ?"
for _, child in pairs(container:GetChildren()) do child:Destroy() end
local options = {currentAns, currentAns + math.random(1, 4), currentAns - math.random(1, 3), currentAns + math.random(5, 8)}
for i = #options, 2, -1 do
local j = math.random(i)
options[i], options[j] = options[j], options[i]
end
local positions = {
UDim2.new(0, 10, 0, 10), UDim2.new(0, 155, 0, 10),
UDim2.new(0, 10, 0, 65), UDim2.new(0, 155, 0, 65)
}
for idx, val in ipairs(options) do
local btn = Instance.new("TextButton")
btn.Size = UDim2.new(0, 135, 0, 45)
btn.Position = positions[idx]
btn.BackgroundColor3 = Color3.fromRGB(50, 55, 80)
btn.Text = tostring(val)
btn.TextColor3 = Color3.fromRGB(255, 255, 255)
btn.Font = Enum.Font.GothamBold
btn.TextSize = 16
btn.Parent = container
local c = Instance.new("UICorner")
c.CornerRadius = UDim.new(0, 8)
c.Parent = btn
btn.MouseButton1Click:Connect(function()
if val == currentAns then
correctAnswers = correctAnswers + 1
scoreLbl.Text = "Benar: " .. correctAnswers
if correctAnswers >= Achievements["Math"].Target then
triggerAchievement("Math")
end
generateQuestion()
else
questionLbl.Text = "Salah! Coba lagi"
task.wait(0.5)
generateQuestion()
end
end)
end
end
generateQuestion()
end
---------------------------------------------------------
-- MINI GAME 4: Color Match
---------------------------------------------------------
local function loadGame4()
menuContainer.Visible = false
gameContainer.Visible = true
titleLabel.Text = "🎨 Color Match"
addBackButton()
local score = 0
local targetColorName = ""
local colors = {
{ Name = "MERAH", Color = Color3.fromRGB(240, 70, 70) },
{ Name = "BIRU", Color = Color3.fromRGB(60, 130, 240) },
{ Name = "HIJAU", Color = Color3.fromRGB(60, 200, 100) },
{ Name = "KUNING", Color = Color3.fromRGB(240, 200, 60) }
}
local targetLbl = Instance.new("TextLabel")
targetLbl.Size = UDim2.new(1, 0, 0, 40)
targetLbl.Position = UDim2.new(0, 0, 0, 35)
targetLbl.BackgroundTransparency = 1
targetLbl.Text = "Pilih Warna:"
targetLbl.TextColor3 = Color3.fromRGB(255, 255, 255)
targetLbl.Font = Enum.Font.FredokaOne
targetLbl.TextSize = 22
targetLbl.Parent = gameContainer
local scoreLbl = Instance.new("TextLabel")
scoreLbl.Size = UDim2.new(1, 0, 0, 20)
scoreLbl.Position = UDim2.new(0, 0, 0, 75)
scoreLbl.BackgroundTransparency = 1
scoreLbl.Text = "Skor: 0"
scoreLbl.TextColor3 = Color3.fromRGB(200, 220, 255)
scoreLbl.Font = Enum.Font.Gotham
scoreLbl.TextSize = 13
scoreLbl.Parent = gameContainer
local btnContainer = Instance.new("Frame")
btnContainer.Size = UDim2.new(0, 280, 0, 120)
btnContainer.Position = UDim2.new(0.5, -140, 0, 105)
btnContainer.BackgroundTransparency = 1
btnContainer.Parent = gameContainer
local function nextRound()
local targetItem = colors[math.random(1, #colors)]
local displayColorItem = colors[math.random(1, #colors)]
targetColorName = targetItem.Name
targetLbl.Text = targetItem.Name
targetLbl.TextColor3 = displayColorItem.Color
for _, v in pairs(btnContainer:GetChildren()) do v:Destroy() end
local positions = {
UDim2.new(0, 10, 0, 10), UDim2.new(0, 145, 0, 10),
UDim2.new(0, 10, 0, 65), UDim2.new(0, 145, 0, 65)
}
for idx, item in ipairs(colors) do
local btn = Instance.new("TextButton")
btn.Size = UDim2.new(0, 125, 0, 45)
btn.Position = positions[idx]
btn.BackgroundColor3 = item.Color
btn.Text = ""
btn.Parent = btnContainer
local c = Instance.new("UICorner")
c.CornerRadius = UDim.new(0, 8)
c.Parent = btn
btn.MouseButton1Click:Connect(function()
if item.Name == targetColorName then
score = score + 1
scoreLbl.Text = "Skor: " .. score
if score >= Achievements["Color"].Target then
triggerAchievement("Color")
end
nextRound()
else
scoreLbl.Text = "Salah! Skor: " .. score
score = 0
task.wait(0.5)
nextRound()
end
end)
end
end
nextRound()
end
---------------------------------------------------------
-- MINI GAME 5: Reaction Test
---------------------------------------------------------
local function loadGame5()
menuContainer.Visible = false
gameContainer.Visible = true
titleLabel.Text = "⏱️ Reaction Test"
addBackButton()
local state = "WAIT"
local startTime = 0
local box = Instance.new("TextButton")
box.Size = UDim2.new(0, 300, 0, 150)
box.Position = UDim2.new(0.5, -150, 0, 45)
box.BackgroundColor3 = Color3.fromRGB(220, 70, 70)
box.Text = "Klik untuk Mulai"
box.TextColor3 = Color3.fromRGB(255, 255, 255)
box.Font = Enum.Font.FredokaOne
box.TextSize = 20
box.Parent = gameContainer
local c = Instance.new("UICorner")
c.CornerRadius = UDim.new(0, 12)
c.Parent = box
box.MouseButton1Click:Connect(function()
if state == "WAIT" then
state = "WAITING_GREEN"
box.BackgroundColor3 = Color3.fromRGB(220, 70, 70)
box.Text = "Tunggu Warna Hijau..."
task.wait(math.random(2, 5))
if state == "WAITING_GREEN" then
state = "READY"
startTime = tick()
box.BackgroundColor3 = Color3.fromRGB(60, 210, 110)
box.Text = "KLIK SEKARANG!"
end
elseif state == "WAITING_GREEN" then
state = "WAIT"
box.BackgroundColor3 = Color3.fromRGB(220, 70, 70)
box.Text = "Terlalu Cepat! Klik lagi"
elseif state == "READY" then
local reactionTime = tick() - startTime
state = "WAIT"
box.BackgroundColor3 = Color3.fromRGB(70, 13