I have a script
local PointA = game.Workspace.A
local Raiders = game.Teams.Raiders
local Defenders = game.Teams.Defenders
local captureTime = 5
local capturedBy = nil
PointA.Touched:Connect(function(part)
if PointA.Captureable.Value == true then
local player = game:GetService("Players"):GetPlayerFromCharacter(part.Parent)
if player then
local PlayerGUI = player:FindFirstChild("PlayerGui")
if player.TeamColor == Raiders.TeamColor and (capturedBy == nil or capturedBy == "Def") then
capturedBy = "Raid"
while PointA.Captureable.Value == true and PointA.Value.Value < 5 do
PointA.Value.Value += 1
wait(1)
if capturedBy == "Def" then
break
end
end
if PointA.Value.Value == 5 then
capturedBy = nil
PointA.Captureable.Value = false
PointB.Captureable.Value = true
end
elseif player.TeamColor == Defenders.TeamColor and capturedBy == "Raid" then
capturedBy = "Def"
while PointA.Captureable.Value == true and (PointA.Value.Value < 5 and PointA.Value.Value > 0) do
PointA.Value.Value -= 1
wait(1)
end
end
PointA.Value.Changed:Connect(function()
if PlayerGUI then
local pointsLabel = PlayerGUI:FindFirstChild("Points")
if pointsLabel then
pointsLabel.A.Text = tostring(PointA.Value.Value) .. " / 400"
end
end
end)
end
end
end)
I need, so progress bar (picture 1) shows progress how much did defenders/raiders captured terminal. It takes 5 seconds to capture terminal. Terminal GUI hierarchy in picture 2 (if you need it)
picture 1
picture 2