Capture Point System

I have this capture point system and I am wanting to remove lines 41-49 since I no longer want a civilian team in my game. But after I delete the lines the entire script just doesn’t work anymore.

local britishid = "rbxassetid://714903662"
wait()
game.Players.PlayerAdded:Connect(function(player)
    for _, model in pairs(workspace:GetChildren()) do
        if model.Name == "Advantage Point" then
            local currTeam = game.Teams["Continental Army"]
            local currPosition = 20
            local currOccupant = game.Teams["Continental Army"]
            local currTime = 0
            local flag = model.Flag
            local status = model:FindFirstChild("Status", true)
            local floor = model.TouchPart
            local origFlagPos = flag.CFrame * CFrame.new(0, -20, 0)
            local val = game.Lighting:WaitForChild("POINTSOWNEDBRIT")
            local val2 = game.Lighting:WaitForChild("POINTSOWNEDCA")
            local ca = game.ReplicatedStorage.CA
            local bri = game.ReplicatedStorage.BRITISH
            local decals = {}
            for i,v in pairs(flag:GetChildren()) do
                if v:IsA("Decal") then
                    decals[v] = v.Texture
                end
            end

            local function changeTextureAmerican()
                for i,v in pairs(flag:GetChildren()) do
                    if v:IsA("Decal") then
                        v.Texture = decals[v]
                    end
                end
            end

            local function changeTextureBritish()
                for i,v in pairs(flag:GetChildren()) do
                    if v:IsA("Decal") then
                        v.Texture = britishid
                    end
                end
            end

            floor.Touched:Connect(function(p)
                if p and p.Parent and p.Parent:FindFirstChild"Humanoid" then
                    local plr = game.Players:GetPlayerFromCharacter(p.Parent)
                    if plr then
                        if plr.Team ~= game.Teams.Civilians then
                            currOccupant = plr.Team
                        end
                    end
                end
            end)

            coroutine.wrap(function()
                while wait(1) do
                    currTime = currTime + 1
                    local team = ""
                    if currTeam == game.Teams["Continental Army"] then
                        team = "Continental"
                    else
                        team = "British"
                    end

                    local minutes = math.floor(currTime/60)
                    if minutes < 10 then
                        minutes = "0" .. tostring(math.floor(currTime/60))
                    end

                    local seconds = currTime%60
                    if seconds < 10 then
                        seconds = "0" .. tostring(currTime%60)
                    end

                    status.Text = team .. " " .. minutes .. ":" .. seconds

                    if currTeam ~= currOccupant then
                        currPosition = currPosition - 1
                        if currPosition < 0 then
                            currPosition = 1
                            currTeam = currOccupant
                            currTime = 0

                            if currOccupant == game.Teams["British Army"] then
                                changeTextureBritish()
                                val.Value += 1
                                val2.Value -= 1
                                ca:FireClient(player)
                                bri:FireClient(player)
                            else
                                changeTextureAmerican()
                                val2.Value += 1
                                val.Value -= 1
                                bri:FireClient(player)
                                ca:FireClient(player)
                            end
                        end
                    else
                        currPosition = currPosition + 1
                        if currPosition > 20 then
                            currPosition = 20
                        end
                    end

                    flag.CFrame = origFlagPos * CFrame.new(0, currPosition, 0)
                end
            end)()
        end
    end
end)

image

If you no longer have the Civilians team, then there is no longer a need to check if the player is in that team, so all you would need to remove are lines 45 and 47.

1 Like