This is my problem:
I have a script that make the entire game works. My game is a "Survive the Tsunamis".
What this script does is: Choose a random map, and Spawns the tsunamis then clear everything and start all that process over again.
The problem is that suddenly,after half an hour or an hour, whatever; It stops working. It spawns the map but the tsunamis dont spawn and stays like that forever. I dont know why it happens, there isnt limited rounds in the script. The only reason i think is that the script suddenly stops working and breaks.
Here is the script:
disasters = {"BigHappyHouse", "Casas Abandonadas", "Casas Apiladas", "Condominio", "Hotel de playa", "Mansion", "Base militar", "Torres Unidas", "Departamento", "Edificio de oficinas", "Avion", "Pueblo Escala", "Horror Mansion", "Hotel Defectuoso"}
getpoints = 15
countdownTime = 10
preparationTime = 25
LeftWaveTime = 15
RightWaveTime = 15
BigWaveTime = 25
CentralWaveTime = 30
CascadaWaveTime = 30
PreparacionTime = 10
aftermathTime = 20
countdownMessage = "La siguiente ronda será en %s segundos"
WdisasterMessage = "El mapa será: %s"
disasterpreparation1 = "El primer Tsunami llegará en: %s"
disasterTimeMessage1 = "Tsunami Izquierdo: %s"
disasterTimeMessage2 = "Tsunami Derecho: %s"
disasterTimeMessage3 = "GRAN Tsunami: %s"
disasterTimeMessage4 = "Olas Centrales: %s"
disasterTimeMessage5 = "Tsunami Cascada: %s"
preparacionmessage = "Preparate para el siguiente Tsunami: %s"
aftermath = "El mapa se limpiará en %s"
items = {}
leaderboard = game.Workspace:findFirstChild("BTS Leaderboard")
local w = game.Workspace:getChildren()
for i=1,#w do
if w[i].Name == "leaderboard" and w[i]:findFirstChild("running") ~= nil and w[i]:findFirstChild("points") ~= ni then
leaderboard = w[i]
end
end
for i=1,#disasters do
local item = game.Lighting:findFirstChild(disasters[i])
if item ~= nil then
item.Parent = nil
table.insert(items, item)
else
print("Error! ", disasters[i], " was not found!")
end
end
function chooseDisaster()
return items[math.random(#items)]
end
function sethint(text)
local hint = game.Workspace:findFirstChild("hint")
if (hint ~= nil) then
hint.Text = text
else
print("Hint does not exist, creating...")
h = Instance.new("Hint")
h.Name = "hint"
h.Text = text
h.Parent = game.Workspace
end
end
function removeHint()
local hint = game.Workspace:findFirstChild("hint")
if (hint ~= nil) then hint:remove() end
end
function countdown(time)
sethint(string.format(countdownMessage, tostring(time)))
while (time > 0) do
wait(1)
time = time - 1
sethint(string.format(countdownMessage, tostring(time)))
end
removeHint()
return true
end
function preparation1(time)
sethint(string.format(disasterpreparation1, tostring(time)))
while (time > 0) do
wait(1)
time = time - 1
sethint(string.format(disasterpreparation1, tostring(time)))
end
removeHint()
return true
end
function wave1(time)
sethint(string.format(disasterTimeMessage1, tostring(time)))
while (time > 0) do
wait(1)
time = time - 1
sethint(string.format(disasterTimeMessage1, tostring(time)))
end
removeHint()
return true
end
function wave2(time)
sethint(string.format(disasterTimeMessage2, tostring(time)))
while (time > 0) do
wait(1)
time = time - 1
sethint(string.format(disasterTimeMessage2, tostring(time)))
end
removeHint()
return true
end
function wave3(time)
sethint(string.format(disasterTimeMessage3, tostring(time)))
while (time > 0) do
wait(1)
time = time - 1
sethint(string.format(disasterTimeMessage3, tostring(time)))
end
removeHint()
return true
end
function wave4(time)
sethint(string.format(disasterTimeMessage4, tostring(time)))
while (time > 0) do
wait(1)
time = time - 1
sethint(string.format(disasterTimeMessage4, tostring(time)))
end
removeHint()
return true
end
function wave5(time)
sethint(string.format(disasterTimeMessage5, tostring(time)))
while (time > 0) do
wait(1)
time = time - 1
sethint(string.format(disasterTimeMessage5, tostring(time)))
end
removeHint()
return true
end
function aftermathh(time)
sethint(string.format(aftermath, tostring(time)))
while (time > 0) do
wait(1)
time = time - 1
sethint(string.format(aftermath, tostring(time)))
end
removeHint()
return true
end
function preparacion01(time)
sethint(string.format(preparacionmessage, tostring(time)))
while (time > 0) do
wait(1)
time = time - 1
sethint(string.format(preparacionmessage, tostring(time)))
end
removeHint()
return true
end
while true do
countdown(countdownTime)
if leaderboard ~= nil and leaderboard:findFirstChild("running") and leaderboard:findFirstChild("points") then
leaderboard.points.Value = getpoints
leaderboard.running.Value = true
end
local m = chooseDisaster():clone()
local LeftTsunami = game.ServerStorage.Tsunamis.TsunamiLeft:Clone()
local RightTsunami = game.ServerStorage.Tsunamis.TsunamiRight:Clone()
local BigTsunami = game.ServerStorage.Tsunamis.TsunamiCentral:Clone()
local CentralTsunami = game.ServerStorage.Tsunamis.TsunamiGeneral:Clone()
local CascadaTsunami = game.ServerStorage.Tsunamis.TsunamiCascada:Clone()
local posicion = Vector3.new(12.5, 48.5, 29.5)
local jugadores = game.Players:GetChildren()
if WdisasterMessage ~= nil then
local msg = Instance.new("Message")
msg.Name = "WDisasterMsg"
msg.Text = string.format(WdisasterMessage, m.Name)
msg.Parent = game.Workspace
wait(3)
msg.Parent = nil
end
m.Parent = game.Workspace
m:makeJoints()
for i = 1, #jugadores do
jugadores[i].Character:MoveTo(posicion)
end
preparation1(preparationTime)
LeftTsunami.Parent = game.Workspace
wave1(LeftWaveTime)
LeftTsunami:remove()
preparacion01(PreparacionTime)
RightTsunami.Parent = game.Workspace
wave2(RightWaveTime)
RightTsunami:remove()
preparacion01(PreparacionTime)
BigTsunami.Parent = game.Workspace
wave3(BigWaveTime)
BigTsunami:remove()
preparacion01(PreparacionTime)
CentralTsunami.Parent = game.Workspace
wave4(CentralWaveTime)
CentralTsunami:remove()
preparacion01(PreparacionTime)
CascadaTsunami.Parent = game.Workspace
wave5(CascadaWaveTime)
CascadaTsunami:remove()
aftermathh(aftermathTime)
m:remove()
if leaderboard ~= nil then
leaderboard.running.Value = false
end
end

3 comments
Well this is a long script!
Are you getting an error message in the output box?
I dont know, because it happens when im playing from the roblox page, i dont know if in the studio happens...