I've been trying to change the disaster script around to change the countdown and messages to GUIs. I've tried everything and it doesn't work. Any help?




countdownTime = 50
disasterTime = 60 

countdownMessage = "The Next Round Will Begin in %s Seconds" -- The message displayed between disasters. %s will be replaced with the number of seconds left.
disasterMessage = "Round: %s" -- The message displayed when a disaster occurs. %s


items = {}
leaderboard = game.Workspace:findFirstChild("BTS Leaderboard") -- Used to work with my 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.StarterGui.Timer:findFirstChild("Timer2")
	game.StarterGui.Timer.Visble = true 
	if (hint ~= nil) then
		game.StarterGui.Timer.Timer2.Text = text
	end
	--print("Hint set to: ", text)
end

function removeHint()
	hint = game.StarterGui.Timer:findFirstChild("Timer2")
	if (hint ~= nil) then game.StarterGui.Time.Timer2.Visible = false
end

function countdown(time)
	sethint (game.StarterGui.Timer.Timer2.Text(countdownMessage, tostring(time)))
	while (time > 0) do
		wait(1) 
		time = time - 1
		game.Workspace.Tick:Play()
		sethint (game.StarterGui.Timer.Timer2.Text(countdownMessage, tostring(time)))
	end
	
	
		
	removeHint()
	return true
end

while true do
	countdown(countdownTime)

	if leaderboard ~= nil and leaderboard:findFirstChild("running") and leaderboard:findFirstChild("points") then -- For use with my BTS leaderboard.
		leaderboard.points.Value = 15 --Points after you survive disasters.
		leaderboard.running.Value = true
	end

	local m = chooseDisaster():clone()

	if disasterMessage ~= nil then
		local msg = Instance.new("Message")
		msg.Name = "DisasterMsg"
		msg.Text = game.StartGui.Round.TextBox.Text(disasterMessage, m.Name)
		msg.Parent = game.Workspace
		wait(3)
		msg.Parent = nil
		game.Workspace.Round:Play()
		function teleAll(x,y,z)

    local pos = Vector3.new(x,y,z)

    for _, plr in pairs(Game:GetService("Players"):GetPlayers()) do

        if plr.Character then

            plr.Character:MoveTo(pos)

        end

    end

end

 
wait(3)
teleAll(3665, 3580.261, 107.2)

		
	end

	m.Parent = game.Workspace
	m:makeJoints()
	wait(disasterTime)
	m:remove()
    game.Workspace.Round:Play()

	if leaderboard ~= nil then -- For use with the bts leaderboard.
		leaderboard.running.Value = false
				function teleAll(x,y,z)

    local pos = Vector3.new(x,y,z)

    for _, plr in pairs(Game:GetService("Players"):GetPlayers()) do

        if plr.Character then

            plr.Character:MoveTo(pos)

        end

    end

end

 

teleAll(-10282.374, 3217.273, -1045.839)
	end
end

5 comments

0

This isn’t even your script. I can tell from the comments and deprecated code.

0

I am also not that great when it comes to making scripts lol

0

To be fair, a friend gave me it, I just modified it

0

So this isn’t your script.

0

Since this isn’t yours, this breaks this rule: "Attempts should be your own work. Don't take a free model and expect us to fix it.^"