0% found this document useful (0 votes)
15 views18 pages

Mini Game Manager Script for Roblox

The document outlines a Lua script for a mini-game manager in a game environment, managing various mini-games and player interactions with a generator. It includes functions for starting and ending games, checking player proximity to a generator, and handling generator repair actions. Additionally, it features server and client scripts that manage generator states, player actions, and game progress updates.

Uploaded by

fleysi.fkiriru
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views18 pages

Mini Game Manager Script for Roblox

The document outlines a Lua script for a mini-game manager in a game environment, managing various mini-games and player interactions with a generator. It includes functions for starting and ending games, checking player proximity to a generator, and handling generator repair actions. Additionally, it features server and client scripts that manage generator states, player actions, and game progress updates.

Uploaded by

fleysi.fkiriru
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

FlowGameManager

---
-- [Link]
local MiniGameManager = {}
MiniGameManager.__index = MiniGameManager

local miniGames = {
require([Link]),
require([Link]),
require([Link]),
require([Link])
}

function [Link]()
local self = setmetatable({}, MiniGameManager)
[Link] = nil
[Link] = nil
[Link] = nil
[Link] = nil
[Link] = nil
[Link] = nil
return self
end

function MiniGameManager:startGame(generatorPart)
if [Link] then
self:endGame()
end

local puzzleUI = [Link]:Clone()


[Link] = [Link]
[Link] = puzzleUI

if not [Link]:GetAttribute("CompletedGenPuzzle") then


[Link] = true
[Link] = [Link](0.5, 0.55)
end

local randomIndex = [Link](1, #miniGames)


[Link] = miniGames[randomIndex].new(self, [Link])

[Link] = [Link]("BindableEvent")
[Link] = [Link]

[Link] = [Link]
[Link] = generatorPart

[Link]:start()

[Link] = [Link]:Connect(function(success)
-- Обработка завершения игры
end)
end

function MiniGameManager:endGame()
if [Link] then
[Link]:Disconnect()
[Link] = nil
end
if [Link] then
[Link]:stop()
[Link] = nil
end

if [Link] then
[Link]:Destroy()
[Link] = nil
end

[Link] = nil
[Link] = nil
end

function MiniGameManager:checkDistance()
if not [Link] or not [Link] then
return false
end

local primaryPart = [Link]


if not primaryPart then return false end

return ([Link] - [Link]).Magnitude <= 3.5


end

return [Link]()
---

Server (generator script)


---
-- <- Services -> --
local Players = game:GetService('Players');
local l_workspace_Attribute_0 = workspace:GetAttribute("BlazeSpecialDay");
-- <- Private Variables -> --
local Generator = script:FindFirstAncestorWhichIsA('Model');
print(Generator, [Link], [Link])
local Remotes = Generator:FindFirstChild('Remotes');
print(Generator:GetChildren())
local humanoid = [Link]
print(humanoid)
local DAMAGE_TO_PROGRESS_RATIO = 0.5

local RF = Remotes:FindFirstChild('RF');
local BE = Remotes:FindFirstChild('BE');
local RE = Remotes:FindFirstChild('RE');

-- <- Functions -> --


function GetNearGenerator(Player: Player)
local GetNearGenerator, GeneratorMag
local Character = [Link]
if not Character then
return
end
--
local PlayerPos = [Link]
--
for Index, Value in [Link]:GetDescendants() do
if [Link] == 'Generator' then
local Main = Value:FindFirstChild('Main');
if Main and Main:IsA('BasePart') then
if GetNearGenerator then
local CurrentMag = ([Link] -
PlayerPos).Magnitude
--
if CurrentMag < GeneratorMag then
GetNearGenerator = Value
GeneratorMag = ([Link] -
PlayerPos).Magnitude
end
else
GetNearGenerator = Value
GeneratorMag = ([Link] - PlayerPos).Magnitude
end
end
end
end
--
return GetNearGenerator, GeneratorMag
end

function GetPosition(Player: Player, GeneratorFound: Model)


local Position, PositionMag, InstanceXd
local Character = [Link]
if not Character then
return
end
--
local PlayerPos = [Link]
--
for Index, Value in GeneratorFound:GetChildren() do
if Value:IsA('Folder') and [Link] == 'Positions' then
for _, Things in Value:GetChildren() do
if Things and Things:IsA('BasePart') then
if Position then
local CurrentMag = ([Link] -
PlayerPos).Magnitude

if CurrentMag < PositionMag then


Position = [Link]
InstanceXd = Things
PositionMag = ([Link] -
PlayerPos).Magnitude
end
else
Position = [Link]
InstanceXd = Things
PositionMag = ([Link] -
PlayerPos).Magnitude
end
end
end
end
end
--
return Position, InstanceXd
end

function HandleRF(Player: Player, Action: string)


local GeneratorFound, Magnitude = GetNearGenerator(Player);
if not GeneratorFound then
return
end
--
local Character = [Link]
if not Character then
return
end
--
if Action == 'enter' then
local Position, PositionInstance = GetPosition(Player, GeneratorFound);
--
if Magnitude >= 10 then
return 'tooFar'
end
--
if [Link] == 'Spectating' then
return 'isUnknownTeam'
end
--
if [Link] == 'Killers' then
return 'isKiller'
end
--
if GeneratorFound:GetAttribute('Completed') then
return 'alreadyFixed'
end
--
if PositionInstance:GetAttribute('Used') then
return 'positionOccupied'
end
--
local NewValue = [Link]('IntValue')
[Link] = 'FixingGenerator'
[Link] = Character:FindFirstChild('SpeedMultipliers')
--
Character:PivotTo([Link])
--
PositionInstance:SetAttribute('Used', true)
PositionInstance:SetAttribute('Player', [Link])
--
return 'fixing', Position, GeneratorFound
elseif Action == 'leave' then
Player:SetAttribute('CompletedGenPuzzle', nil);
--
local Position, PositionInstance = GetPosition(Player, GeneratorFound);
PositionInstance:SetAttribute('Used', nil);
PositionInstance:SetAttribute('Player', nil);
--
if
Character:FindFirstChild('SpeedMultipliers'):FindFirstChild('FixingGenerator') then

Character:FindFirstChild('SpeedMultipliers'):FindFirstChild('FixingGenerator'):Dest
roy()
end
--
return 'notFixing'
end
end

function HandleBE(Player: Player, ...)


warn(...)
end

function HandleRE(Player: Player, ...) -- CompletedGenPuzzle


local GeneratorFound, Magnitude = GetNearGenerator(Player)
if not GeneratorFound then
return
end
--
local Progress = GeneratorFound:FindFirstChild('Progress')
if not Progress then
return
end
--
--[Link] += GeneratorFound:GetAttribute('PowerGain')
--
-- Удваиваем, если у игрока есть атрибут
local character = [Link]
local powerGain = GeneratorFound:GetAttribute('PowerGain') or 13

-- проверка атрибута на МОДЕЛИ персонажа


local DrAegisCount = 0
for _, survivor in pairs([Link]:GetChildren()) do
if [Link] == "DrAegis" then
DrAegisCount = DrAegisCount + 1
end
end

-- Calculate reduced chance based on DrAegis count (10% reduction per


DrAegis)
local baseChance = 0.5 -- 50% base chance
local reducedChance = [Link](0, baseChance - (0.1 * DrAegisCount)) --
Minimum 0% chance

if character and character:GetAttribute("DoubleGenSpeed") then


if [Link]() < reducedChance then -- Reduced chance based on
DrAegis count
powerGain *= 2
print("(x2 power applied) - Chance was "..
(reducedChance*100).."%")
else
print("(failed roll) - Chance was "..(reducedChance*100).."%")
end
else
print("no attribute")
end

[Link] += powerGain
--
if [Link] >= 100 and not GeneratorFound:GetAttribute('Completed')
then -- ObjectivesCompleted
BE:Fire(GeneratorFound, [Link])
--
GeneratorFound:FindFirstChild('Progress'):SetAttribute('Completed',
true)
GeneratorFound:SetAttribute('Completed', true)

GeneratorFound:FindFirstChild('Instances'):FindFirstChild('Generator'):SetAttribute
('Completed', true)

GeneratorFound:FindFirstChild('Progress'):SetAttribute('Invincible',
true)
GeneratorFound:SetAttribute('Invincible', true)

GeneratorFound:FindFirstChild('Instances'):FindFirstChild('Generator'):SetAttribute
('Invincible', true)
--
for Index, Value: BasePart in
GeneratorFound:FindFirstChild('Positions'):GetChildren() do
local Player = Value:GetAttribute('Player');
if not Player then
continue
end
--
Player = [Link]:FindFirstChild(Player);
Player:SetAttribute('CompletedGenPuzzle', true);
--
if [Link] and
[Link]:FindFirstChild('SpeedMultipliers') then

[Link]:FindFirstChild('SpeedMultipliers'):FindFirstChild('FixingGenerator
'):Destroy()
end
--
local PlayerData: Folder = Player:FindFirstChild('PlayerData');
if not PlayerData then
continue
end
--
local Stats = PlayerData:FindFirstChild('Stats');
if not Stats then
continue
end
--
local WonFolderThingy = Stats:FindFirstChild(`SurvivorStats`);
if not WonFolderThingy then
continue
end
--
local ObjectivesCompleted =
WonFolderThingy:FindFirstChild(`ObjectivesCompleted`)
if ObjectivesCompleted then
[Link] += 1
end
end
--
return
end
end

local function OnHealthChanged(newHealth)


local GeneratorFound = Generator
if not GeneratorFound then return end

local Progress = GeneratorFound:FindFirstChild('Progress')


if not Progress then return end

if Generator:GetAttribute("Completed") then return end

local maxHealth = [Link]


local damageDealt = maxHealth - newHealth
if damageDealt <= 0 then return end

-- Получаем никнейм атакующего из атрибута


local attackerName =
Generator:FindFirstChild("Instances"):FindFirstChild("Generator"):GetAttribute("Rec
entAttacker")
if not attackerName then
[Link] = maxHealth -- отменяем урон
print("ноу аттакер наме")
return
end

-- Проверяем, что атакующий - киллер


local attacker = [Link]:FindFirstChild(attackerName)
if attacker and [Link] and [Link] and
[Link] ~= "Killers" then
[Link] = maxHealth -- отменяем урон, если это не киллер
print(attacker, [Link], "галя отмена, не киллер")
return
end

-- Восстанавливаем здоровье и наносим урон по прогрессу


print("все гуд, дамаг прошел")
[Link] = maxHealth
local progressLoss = damageDealt * DAMAGE_TO_PROGRESS_RATIO
[Link] = [Link]([Link] - progressLoss, 0, 100)
end

-- <- Connections -> --


[Link] = function(Player: Player, ...)
return HandleRF(Player, ...)
end

[Link]:Connect(HandleRE)
[Link]:Connect(HandleBE)

[Link]:Connect(OnHealthChanged)
---

Client (client generator script)


---
-- [Link]
local Player = [Link]
local Generator = [Link]
local Progress = Generator:WaitForChild("Progress")
local Prompt = Generator:WaitForChild("Main"):WaitForChild("Prompt", 10)
local Remotes = Generator:WaitForChild("Remotes")
local RE = Remotes:WaitForChild("RE")
local RF = Remotes:WaitForChild("RF")
local Util = require([Link])
local Sounds = require([Link])
local GameManager = nil
local BackgroundUI = nil
local Connections = {}
local Tasks = {}
local isFixing = false

local function showWarning(message)


local warning =
[Link]:FindFirstChild("GeneratorWarning")
if warning then warning:Destroy() end

warning = [Link]:Clone()
[Link] = "GeneratorWarning"
[Link] = message
[Link] = [Link]

[Link]:Create(warning, [Link](0.35), {
Size = [Link] + [Link](0.025, 0.01)
}):Play()

[Link](3, function()
if [Link] then
[Link]:AddItem(warning, 1)
[Link]:Create(warning, [Link](1,
[Link], [Link]), {
BackgroundTransparency = 1
}):Play()
[Link]:Create([Link], [Link](1,
[Link], [Link]), {
TextTransparency = 1,
TextStrokeTransparency = 1,
BackgroundTransparency = 1
}):Play()
end
end)
end

local function stopFixing(success)


if [Link] then
[Link]:Disconnect()
[Link] = nil
end

isFixing = false
if Prompt then [Link] = true end

if success then
Sounds:Play("puzzlesDone", { Parent = [Link] })
end
if GameManager then
GameManager:endGame()
GameManager = nil
end

if BackgroundUI then
[Link]:AddItem(BackgroundUI, 0.4)
[Link]:Create([Link], [Link](0.4), {
BackgroundTransparency = 1
}):Play()
for _, child in pairs(BackgroundUI:GetDescendants()) do
if child:IsA("ImageLabel") then
[Link]:Create(child, [Link](0.3), {
ImageTransparency = 1
}):Play()
end
end
end

for _, connection in pairs(Connections) do


connection:Disconnect()
end
[Link](Connections)

for _, task in pairs(Tasks) do


task:Stop()
end
[Link](Tasks)

local speedMultipliers = [Link] and


[Link]:FindFirstChild("SpeedMultipliers")
local fixingGen = speedMultipliers and
speedMultipliers:FindFirstChild("FixingGenerator")
if fixingGen then
fixingGen:Destroy()
end
end

-- Объявляем функции заранее для взаимного вызова


local toggleGeneratorState
local startFixing

toggleGeneratorState = function(action)
local character = [Link]
if not character or not [Link] then return end

local result, position, generator = RF:InvokeServer(action)

local messages = {
tooFar = "Move closer to the generator",
positionOccupied = "Position occupied, try another side",
alreadyFixed = "Generator already fixed",
isKiller = "Killers can't fix generators",
isUnknownTeam = "Spectators can't fix generators"
}

if messages[result] then
showWarning(messages[result])
elseif not result then
showWarning("Unknown error occurred")
end

if result == "fixing" then


startFixing(position)
elseif result == "notFixing" then
stopFixing()
end
end

startFixing = function(positionPart)
local character = [Link]
if not character or not [Link] then return end

isFixing = true
if Prompt then [Link] = false end

GameManager = require([Link])
GameManager:startGame(positionPart)

if BackgroundUI then BackgroundUI:Destroy() end


BackgroundUI = [Link]:Clone()
[Link] = [Link]

[Link]:Create([Link], [Link](0.4), {
BackgroundTransparency = 0.75
}):Play()

if not Player:GetAttribute("CompletedGenPuzzle") then


[Link] = [Link](0.5, 0.55)
end

for _, child in pairs(BackgroundUI:GetDescendants()) do


if child:IsA("ImageLabel") then
local transparency = [Link]
[Link] = 1
[Link]:Create(child, [Link](0.4), {
ImageTransparency = transparency
}):Play()
end
end

local function updateProgress()


if [Link] then
local progress = [Link]([Link] / 100, 0, 1)

[Link]:Create([Link],
[Link](0.2), {
Size = [Link](1, progress)
}):Play()
end
end

[Link] =
Progress:GetPropertyChangedSignal("Value"):Connect(updateProgress)
updateProgress()

[Link] = [Link]:Connect(function(success)
if success then
RE:FireServer() -- отправляем на сервер, чтобы он увеличил
прогресс

if [Link] < 100 then


Sounds:Play("puzzleDone", { Parent =
[Link] })
GameManager:endGame()
[Link](0.5)
startFixing(positionPart) -- запускаем новую мини-игру
else
stopFixing(true) -- генератор починен
end
else
-- Если мини-игра провалена, просто останавливаем
stopFixing(false)
end
end)

[Link] =
game:GetService("RunService").Heartbeat:Connect(function()
if not positionPart or not [Link] or not [Link]
or not [Link] then
stopFixing()
return
end

local distance = ([Link] -


[Link]).Magnitude
if distance > 7 then
stopFixing()
toggleGeneratorState("leave")
end
end)
end

if Prompt then
[Link]:Connect(function()
toggleGeneratorState("enter")
end)
end

Progress:GetPropertyChangedSignal("Value"):Connect(function()
local bar = [Link]
local progress = [Link] / 100
[Link]:Create(bar, [Link](0.5), {
Size = [Link](progress, 1),
BackgroundTransparency = 1 - progress
}):Play()
end)

[Link]:Connect(function(_, parent)
if not parent then
stopFixing()
end
end)
---
QuickTimeEvent (one of the minigames)
---
-- [Link]
local QuickTimeEvent = {}
QuickTimeEvent.__index = QuickTimeEvent

function [Link](gameManager, container)


local self = setmetatable({}, QuickTimeEvent)
[Link] = gameManager
[Link] = container
[Link] = [Link]("BindableEvent")
return self
end

function QuickTimeEvent:start()
-- Проверка контейнера
if not [Link] or not [Link]:IsA("GuiObject") then
warn("Invalid container for QuickTimeEvent")
[Link]:Fire(false)
return
end

-- Основной фрейм
[Link] = [Link]("Frame")
[Link] = [Link](1, 0, 1, 0)
[Link].BackgroundColor3 = [Link](0.1, 0.1, 0.2)
[Link] = 0.5
[Link] = 2
[Link].BorderColor3 = [Link](1, 1, 1)
[Link] = [Link]

-- Текстовая метка
[Link] = [Link]("TextLabel")
[Link] = [Link](1, 0, 0.5, 0)
[Link] = [Link](0, 0, 0.25, 0)
[Link] = 1
[Link] = ""
[Link].TextColor3 = [Link](1, 1, 1)
[Link] = true
[Link] = [Link]
[Link] = 0.7
[Link].TextStrokeColor3 = [Link](0, 0, 0)
[Link] = [Link]

[Link] = {}
local possibleKeys = {"Z", "X", "C", "F", "G", "V", "H", "K", "L"}
for i=1,4 do
[Link]([Link], possibleKeys[[Link](1,
#possibleKeys)])
end
[Link] = 1

self:showNextKey()

[Link] =
game:GetService("UserInputService").InputBegan:Connect(function(input, processed)
if processed then return end
if [Link] == [Link][[Link]] then
[Link] = [Link] + 1
if [Link] > #[Link] then
[Link]:Fire(true)
else
self:showNextKey()
end
else
[Link]:Fire(false)
end
end)
end

function QuickTimeEvent:showNextKey()
[Link] = "Press: " .. [Link][[Link]]
end

function QuickTimeEvent:stop()
if [Link] then
[Link]:Disconnect()
end
if [Link] then
[Link]:Destroy()
end
end

return QuickTimeEvent
---

ReactionTest (one of the minigames)


---
-- [Link]
local ReactionTest = {}
ReactionTest.__index = ReactionTest

function [Link](gameManager, container)


local self = setmetatable({}, ReactionTest)
[Link] = gameManager
[Link] = container
[Link] = [Link]("BindableEvent")
return self
end

function ReactionTest:start()
-- Проверка контейнера
if not [Link] or not [Link]:IsA("GuiObject") then
warn("Invalid container for ReactionTest")
[Link]:Fire(false)
return
end

-- Основной фрейм
[Link] = [Link]("Frame")
[Link] = [Link](1, 0, 1, 0)
[Link].BackgroundColor3 = [Link](0.1, 0.1, 0.2)
[Link] = 0.5
[Link] = 2
[Link].BorderColor3 = [Link](1, 1, 1)
[Link] = [Link]

-- Кнопка
[Link] = [Link]("TextButton")
[Link] = [Link](0.4, 0, 0.4, 0)
[Link] = [Link](0.3, 0, 0.3, 0)
[Link].BackgroundColor3 = [Link](1, 0, 0)
[Link].TextColor3 = [Link](1, 1, 1)
[Link] = "WAIT"
[Link] = true
[Link] = [Link]
[Link] = [Link]

[Link] = 0
[Link] = "waiting" -- waiting, active, finished

[Link].MouseButton1Click:Connect(function()
if [Link] == "active" then
[Link] = "finished"
[Link]:Fire(true)
elseif [Link] == "waiting" then
[Link]:Fire(false)
end
end)

[Link] =
game:GetService("RunService").Heartbeat:Connect(function(dt)
[Link] = [Link] + dt

if [Link] == "waiting" and [Link] > [Link](1, 3) then


[Link] = "active"
[Link].BackgroundColor3 = [Link](0, 1, 0)
[Link] = "CLICK NOW!"
[Link] = tick()
end
end)
end

function ReactionTest:stop()
if [Link] then [Link]:Disconnect() end
if [Link] then [Link]:Destroy() end
end

return ReactionTest
---

SequenceMemory (one of the minigames)


---
-- [Link]
local SequenceMemory = {}
SequenceMemory.__index = SequenceMemory

function [Link](gameManager, container)


local self = setmetatable({}, SequenceMemory)
[Link] = gameManager
[Link] = container
[Link] = [Link]("BindableEvent")
return self
end

function SequenceMemory:start()
-- Проверка контейнера
if not [Link] or not [Link]:IsA("GuiObject") then
warn("Invalid container for SequenceMemory")
[Link]:Fire(false)
return
end

-- Основной фрейм
[Link] = [Link]("Frame")
[Link] = [Link](1, 0, 1, 0)
[Link].BackgroundColor3 = [Link](0.1, 0.1, 0.2)
[Link] = 0.5
[Link] = 2
[Link].BorderColor3 = [Link](1, 1, 1)
[Link] = [Link]

[Link] = {}
[Link] = {}
[Link] = {}
[Link] = 1

local positions = {
[Link](0.3, 0, 0.3, 0),
[Link](0.6, 0, 0.3, 0),
[Link](0.3, 0, 0.6, 0),
[Link](0.6, 0, 0.6, 0)
}

for i = 1, 4 do
local button = [Link]("TextButton")
[Link] = [Link](0.25, 0, 0.25, 0)
[Link] = positions[i]
button.BackgroundColor3 = [Link](0.2, 0.2, 0.2)
button.TextColor3 = [Link](1, 1, 1)
[Link] = tostring(i)
[Link] = true
[Link] = [Link]
[Link] = [Link]

button.MouseButton1Click:Connect(function()
self:playerPressed(i)
end)

[Link]([Link], button)
end

self:generateSequence()
self:playSequence()
end

function SequenceMemory:generateSequence()
[Link] = {}
for i = 1, 4 do
[Link]([Link], [Link](1, 4))
end
end

function SequenceMemory:playSequence()
for i, buttonIndex in ipairs([Link]) do
[Link](0.8)
[Link][buttonIndex].BackgroundColor3 = [Link](1, 1, 1)
[Link](0.3)
[Link][buttonIndex].BackgroundColor3 = [Link](0.2, 0.2, 0.2)
end
[Link] = {}
[Link] = 1
end

function SequenceMemory:playerPressed(buttonIndex)
[Link]([Link], buttonIndex)

if buttonIndex == [Link][[Link]] then


[Link] = [Link] + 1
if [Link] > #[Link] then
[Link]:Fire(true)
end
else
[Link]:Fire(false)
end
end

function SequenceMemory:stop()
for _, button in ipairs([Link]) do
button:Destroy()
end
if [Link] then [Link]:Destroy() end
end

return SequenceMemory
---

HoldButton (one of the minigames)


---
local HoldButton = {}
HoldButton.__index = HoldButton

function [Link](gameManager, container)


local self = setmetatable({}, HoldButton)
[Link] = gameManager
[Link] = container
[Link] = [Link]("BindableEvent")
return self
end

function HoldButton:start()
-- Проверяем, что контейнер существует
if not [Link] or not [Link]:IsA("GuiObject") then
warn("Invalid container for HoldButton game")
[Link]:Fire(false)
return
end
-- Создаем основной GUI
[Link] = [Link]("Frame")
[Link] = "HoldButtonGame"
[Link] = [Link](1, 0, 1, 0)
[Link].BackgroundColor3 = [Link](0.1, 0.1, 0.2)
[Link] = 0.5
[Link] = 0
[Link] = [Link]

-- Прогресс бар
[Link] = [Link]("Frame")
[Link] = [Link](0.8, 0, 0.1, 0)
[Link] = [Link](0.1, 0, 0.45, 0)
[Link].BackgroundColor3 = [Link](0.3, 0.3, 0.3)
[Link] = 2
[Link].BorderColor3 = [Link](1, 1, 1)
[Link] = [Link]

-- Заполнение прогресса
[Link] = [Link]("Frame")
[Link] = [Link](0, 0, 1, 0)
[Link].BackgroundColor3 = [Link](0, 1, 0)
[Link] = 0
[Link] = [Link]

-- Целевая зона
[Link] = [Link]("Frame")
[Link] = [Link](0.2, 0, 1, 0)
[Link] = [Link](0.7, 0, 0, 0)
[Link].BackgroundColor3 = [Link](1, 1, 0)
[Link] = 0.3
[Link] = 1
[Link].BorderColor3 = [Link](1, 1, 1)
[Link] = [Link]

-- Инструкции
[Link] = [Link]("TextLabel")
[Link] = [Link](1, 0, 0.2, 0)
[Link] = [Link](0, 0, 0.3, 0)
[Link] = 1
[Link] = "HOLD [E] AND RELEASE IN YELLOW ZONE!"
[Link].TextColor3 = [Link](1, 1, 1)
[Link] = true
[Link] = [Link]
[Link] = 0.5
[Link].TextStrokeColor3 = [Link](0, 0, 0)
[Link] = [Link]

-- Логика игры
[Link] = false
[Link] = 0.5 -- Скорость заполнения
[Link] = 0.7 -- Минимальная позиция цели
[Link] = 0.9 -- Максимальная позиция цели

-- Обработка ввода
[Link] =
game:GetService("UserInputService").InputBegan:Connect(function(input)
if [Link] == [Link].E then
[Link] = true
end
end)

[Link] =
game:GetService("UserInputService").InputEnded:Connect(function(input)
if [Link] == [Link].E then
[Link] = false
local fillWidth = [Link]
if fillWidth >= [Link] and fillWidth <= [Link]
then
[Link]:Fire(true)
else
[Link]:Fire(false)
end
end
end)

-- Обновление прогресса
[Link] =
game:GetService("RunService").Heartbeat:Connect(function(dt)
if [Link] then
local newWidth = [Link](1, [Link] +
[Link] * dt)
[Link] = [Link](newWidth, 0, 1, 0)
end
end)
end

function HoldButton:stop()
-- Очищаем соединения
if [Link] then [Link]:Disconnect() end
if [Link] then [Link]:Disconnect() end
if [Link] then [Link]:Disconnect() end

-- Удаляем GUI
if [Link] and [Link] then
[Link]:Destroy()
end
end

return HoldButton
---

You might also like