So I’m currently making a game and I need the script to reset once the chosen player dies. I tried using a return but to no avail. Any help is appreciated!
local players = game.Players
local Intermission = 10
local NormalMaps = game:GetService("ReplicatedStorage"):WaitForChild("Maps").NormalMaps:GetChildren()
local Announcement = script.Announcement
local gameisactive = false
wait(2)
while true do
if gameisactive == false then
Intermission = 10
Announcement.Value = "Picking Giant."
wait(.5)
Announcement.Value = "Picking Giant.."
wait(.5)
Announcement.Value = "Picking Giant..."
local Giant = players:GetPlayers()[math.random(1, #players:GetPlayers())]
Announcement.Value = Giant.Name.. " has been Chosen as the Giant!"
workspace.ActiveMap:ClearAllChildren()
local ChosenMap = NormalMaps[math.random(1, #NormalMaps)]
ChosenMap.Parent = workspace.ActiveMap
repeat wait(1)
Intermission -=1
Announcement.Value = Intermission
until Intermission == 0
Announcement.Value = "Game Started!"
gameisactive = true
while wait() do
if Giant.Character:WaitForChild("Humanoid").Health == 0 then
gameisactive = false
print("Game has Ended!")
Announcement.Value = Giant.Name.. " Has been Slayed!"
-- This is when the script should return to the top and restart
end
end
end
end```