the title is self explanatory, i’m working on a game that is about 2 teams capturing eachothers land and sword fighting to eliminate other players. here’s the source code help is appreciated!
local part = script.Parent
local siegetime = 5
local sieging = false
local ogcolor = part.BrickColor
local ss = game.ReplicatedStorage
local values = ss.Values
local redcaps = values.RedCaptures
local bluecaps = values.BlueCaptures
part.Touched:Connect(function(hit)
local rs = game:GetService("ReplicatedStorage")
local capture = rs.CaptureEvent
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local hum = plr.Character:WaitForChild("Humanoid")
hum.Died:Connect(function()
sieging = false
end)
local pgui = plr:WaitForChild("PlayerGui")
local siegegui = pgui.SiegeGui
if sieging == true or part.BrickColor == plr.Team.TeamColor then
return
else
sieging = true
hum.Died:Connect(function()
sieging = false
part.BrickColor = ogcolor
end)
plr.Character:WaitForChild("Humanoid").WalkSpeed = 0
siegegui.Enabled = true
for i = 1,5 do
siegetime = siegetime-1
siegegui.Main.Countdown.Text = "Sieging " .. siegetime .. " seconds left."
if siegetime <= 0 then
siegetime = 5
siegegui.Main.Countdown.Text = "Siege Concluded!"
if plr.Team.TeamColor == BrickColor.new("Really red") then
redcaps.Value = redcaps.Value + 1
bluecaps.Value = bluecaps.Value - 1
elseif plr.Team.TeamColor == BrickColor.new("Dark blue") then
bluecaps.Value = bluecaps.Value + 1
redcaps.Value = redcaps.Value - 1
end
end
task.wait(1)
end
part.BrickColor = plr.Team.TeamColor
sieging = false
plr.Character:WaitForChild("Humanoid").WalkSpeed = 16
siegegui.Enabled = false
end
end)