Random Tornado Script not working

I ran into a problem where the disasters in my game repeat the same disaster from last round.

The current Script I have so far is this right here, It selects random disasters and spawns them in when the round is about to start.

local Status = game.ReplicatedStorage.Status

local clonedMap = workspace.Map:Clone()

local Tornadoes = {"EF5","FireWhirl"}
local Tornado = Tornadoes[math.random(1, #Tornadoes)]

local EF5Tornado = game.ServerStorage.Objects.Tornado
local FireNado = game.ServerStorage.Objects.FireNado

local TeleportGUI = workspace.Teleport

local timeForGameToStart = 5
local timeToEndGame = 10

while true do
	wait(2)
	Status.Value = "Game starting soon"
	wait(timeForGameToStart)
	Status.Value = "Teleporting players..."
	local players = game.Players:GetPlayers()
	for i,plrs in pairs(players) do
		local plrName = plrs.Name
		local plrChar = workspace[plrName]
		plrChar:MoveTo(workspace.Map.TeleportPoint.Position + Vector3.new(0,5,0))
	end
	wait(3)
	Status.Value = "There seems to be a tornado forming soon"
	wait(4)
	Status.Value = "Try to seek shelter soon as this may be very dangerous"
	wait(10)
	TeleportGUI.Parent = game.StarterGui
	
	--Selects tornado and what they do
	if Tornado == "EF5" then
		
		EF5Tornado.Parent = workspace.TornadoFolder
		Status.Value = "THE TORNADO HAS FORMED, EVERYONE SEEK SHELTER IMMEDIATELY"
		print("EF5")
		
	elseif Tornado == "FireWhirl" then
		
		FireNado.Parent = workspace.TornadoFolder
		Status.Value = "ITS A FIREWHIRL, EVERYONE RUN AND STAY AWAY FROM IT"
		print("FireWhirl")
		
	end
	
	wait(timeToEndGame)
	TeleportGUI.Parent = game.Workspace
	
	--Game Reset thing
	EF5Tornado.Parent = game.ServerStorage.Objects
	FireNado.Parent = game.ServerStorage.Objects
	
	Status.Value = "It seems that the tornado is gone"
	wait(4)
	Status.Value = "It is now safe to exit your shelters now"
	wait(4)
	Status.Value = "Resetting Game..."
	for i,plrs in pairs(players) do
		local plrName = plrs.Name
		local plrChar = workspace[plrName]
		plrChar.Humanoid.Health = 0
	end
	workspace.Map:Destroy()
	wait(3)
	clonedMap:Clone().Parent = workspace
	wait(5)
end

I haven’t been really able to find a solution to this so far so if you could explain what’s wrong with the code then that would be great!

That’s because you didn’t put this in the while true do loop, when the script first run this script, it only goes to this line once. To make it run this line multiple times, you must put it in a continuous loop.

2 Likes