Congrats on beginning to script! I'll start by saying that you should definitely have functions here and not just a bunch of free-floating while loops. Furthermore, you should never have more than 1 while true loop. It's difficult to tell what you want with your code, however, I've gone ahead and coded what I interpreted from looking at your code.
I've also reformatted most of your code, hopefully you can see the differences and remember them. The most important would be the unnecessary while true loops that you just end up breaking out of anyway and the false indentation.
local dscore = script.DefenderScore
local s = script.Stat
local ascore = script.AttackScore
local gameStarted = false
local function startGame()
t = 5
repeat
t = t-1
s.Value = "Game Starting In "..t.." Seconds"
wait(1)
until t == 0
gameStarted = true
s.Value = "Game Starting"
wait(2)
for i, v in pairs(game.Teams.Orange:GetPlayers()) do
v.Character.Head:Destroy()
end
for i, v in pairs(game.Teams.Blue:GetPlayers()) do
v.Character.Head:Destroy()
end
end
local function checkScores()
if dscore > 3 then
s.Value = "Orange Wins The Game"
gameStarted = false
end
if ascore > 3 then
s.Value = "Blue Wins The Game"
gameStarted = false
end
end
while gameStarted == true do
checkScores()
wait(1)
end
startGame()
5 comments
I am unable to view your code but when I do anything with rounds I usually use recursion to run an infinite number of rounds. https://www.lua.org/pil/6.3.html
With resetting the map, at the beginning of the round clone the map from serverstorage to the workspace and set it to a variable in your code. At the end of the round simply destroy the map by using the variable you set earlier.
http://idownvotedbecau.se/nocode
For detecting when the attacking team wins, you can use the collection service or tables to keep track of which players are on which teams. When the number of players on a team equals zero then the opposite team wins.
programmerHere wdym no code? he has a link to PasteBin