• I'm trying to add a player win after all the spawns of the other doom spires have been destroyed

  • Tested, no result

  • Pretty sure the error line is Wins.Value=Wins.Value+1

  • In Server Script Service

       PlayersRequiredToStartAwardingPoints=2
    

    local y=workspace:GetDescendants()

      local Wins=player.leaderstats.Wins
      
        
      
      for s=1,#y do
      
      if y[s].Name=="Doomspires" then
      
      -- GAME VALUES --
      
      local GVF=Instance.new("Folder")
      
      GVF.Parent=y[s]
      
      GVF.Name="GameValues"
      
      local TF=Instance.new("Folder")
      
      TF.Parent=GVF
      
      TF.Name="Teams"
      
      local TeamsLeftInt=Instance.new("IntValue")
      
      TeamsLeftInt.Parent=GVF
      
      TeamsLeftInt.Name="TeamsLeft"
      
      local k=y[s]:GetChildren()
      
      for o=1,#k do
      
      if not k[o]:IsA("Script") then -- Only make values
      
      if k[o].Name~="GameValues" then
      
      if k[o].Name~="Holder" then
      
      local BCV=Instance.new("BrickColorValue")
      
      BCV.Parent=TF
      
      BCV.Name=k[o].Name
      
      local SpawnVal=Instance.new("IntValue")
      
      SpawnVal.Parent=BCV
      
      SpawnVal.Name="Spawns"
      
      local u=k[o]:GetDescendants()
      
      for h=1,#u do
      
      if u[h]:IsA("SpawnLocation") then
      
      BCV.Value=u[h].TeamColor
      
      SpawnVal.Value=#u[h].Parent:GetChildren()
      
      end
      
      end
      
      end
      
      end
      
      end
      
      end
      
      TeamsLeftInt.Value=#TF:GetChildren()
      
      if y[s]:WaitForChild("GameValues",1):WaitForChild("TeamsLeft",1).Value==1 then -- If 1 team remains then
      
      local e=y[s]:WaitForChild("GameValues",1):WaitForChild("Teams",1):GetDescendants()
      
      for j=1,#e do
      
      if e[j].Name=="Spawns" then
      
      if e[j].Value~=0 then -- ... find that team, whose spawn does NOT have a value of zero
      
      wait(4)
      
      local msg=Instance.new("Message")
      
      msg.Text=e[j].Parent.Name.." TEAM has won the game!"
      
      local p=game.Players:GetChildren()
      
      for q=1,#p do
      
      if #p>=PlayersRequiredToStartAwardingPoints then -- if there's more than 4 people playing then
      
      if e[j].Parent and p[q].TeamColor==e[j].Parent.Value then
      
      Wins.Value=Wins.Value+1
      
      end
      
      end
      
      end
      
      msg.Parent=workspace
      
      script.RegenScriptLocation.Value.Signal.Value=true -- ... regen the map using the Changed function.
      
      return
      
      end
      
      end
      
      end
      
      end
      
      end
      
      end)
    

3 comments

0

Indent. Please.

0

^

0

I cant see where u define what a player is