-
What do you want to achieve? Keep it simple and clear!
I want to make my round script resets when all players is dead except for the monster -
What is the issue? Include screenshots / videos if possible!
when all soldiers is dead the round won’t reset -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i tried other things like using tables
Here’s my script
for i = 1, #Players do
if Players[i].Playing.Value == true and Players[i].isAFK.Value == false then
if Players[i].Character ~= nil and Players[i].Character:FindFirstChild("Torso") ~= nil and Players[i].Character.Humanoid.Health > 0 and Players[i] ~= Chosen then
local Spawn = nil
Spawn = game.Workspace.Map.Spawns.Spawn
Players[i].PlayerGui.Role.Enabled = true
Players[i].CameraMode = Enum.CameraMode.LockFirstPerson
Players[i].Character.HumanoidRootPart.CFrame = CFrame.new(Spawn.Position)
table.insert(Soldiers, Players[i].Name)
print("Inserted")
Players[i].PlayerGui.Role.BGF.Niichan.Text = "Soldier"
Players[i].PlayerGui.Role.Info.InfoChan.Text = "You're a Soldier Sent out by the Goverment to hunt an escapee Mutant,The Mutant is going on a rampage and you need to stop it before it kills more people!"
Players[i].PlayerGui.Role.BGF.Niichan.TextColor3 = Color3.fromRGB(71, 255, 20)
Spawn:Destroy()
Players[i].Character.Humanoid.WalkSpeed = 0
elseif Players[i].Character.Humanoid.Health < 0 then
Players[i].Playing.Value = false
elseif Players[i] == Chosen then
local Spawn = nil
Spawn = game.Workspace.Map.Spawns.Spawn
Chosen.Monster.Value = true
Chosen.PlayerGui.Role.Enabled = true
Chosen.PlayerGui.Role.BGF.Niichan.Text = "Monster"
Chosen.PlayerGui.Role.Info.InfoChan.Text = "You're a Mutant Created by the Goverment,You Escaped and now the Goverment is Hunting You. Your Goal Here is to survive and kill all the Soldiers.Good Luck!"
Chosen.PlayerGui.Role.BGF.Niichan.TextColor3 = Color3.fromRGB(255, 0, 4)
Players[i].Character.HumanoidRootPart.CFrame = CFrame.new(Spawn.Position)
Players[i].Character.Humanoid.WalkSpeed = 0
end
end
end
script.Parent.CountDown:Play()
for i = 5, 0, -1 do
ChangeText('Starting in ' ..i)
wait(1)
end
local Players = game.Players:GetPlayers()
for i = 1, #Players do
if Players[i].Playing.Value == true then
Players[i].Character.Humanoid.WalkSpeed = 16
end
end
ChangeText('BEGIN!')
for i = 1, #Players do
if Players[i].Playing.Value == true and Players[i].isAFK.Value == false then
if Players[i].Character ~= nil and Players[i].Character:FindFirstChild("Torso") ~= nil and Players[i].Character.Humanoid.Health > 0 and Players[i] ~= Chosen then
local Weapon = game.ServerStorage.Weapons:WaitForChild(Players[i]:WaitForChild("Weapon").Value)
Weapon:Clone().Parent = Players[i].Backpack
if Players[i].Character.Humanoid.Health == 0 then
Players[i].Playing.Value = false
print("One Dead")
table.remove(Soldiers,Players[i].Name)
end
end
end
end
for i = GameTime, 0, -1 do -- Time Counter
if Chosen.Character.Humanoid.Health ~= 0 then
ChangeText('GameTime ' ..i)
local waittime = 1
GameWait(waittime)
elseif Chosen.Character.Humanoid.Health == 0 then
ChangeText('MUTANT DEAD!')
Chosen.Playing.Value = false
Chosen.Monster.Value = false
break
elseif #Soldiers < 1 then
print("Restarting All players")
break
elseif Players[i].Character.Humanoid.Health == 0 then
Players[i].Playing.Value = false
print("One Dead")
table.remove(Soldiers,Players[i].Name)
end
end