Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Will this Intermission Script work?

while true do

local startingtime = 100
local maps = game.Lighting.maps:getchildren()
ranMap = math.random getmapschildren() (#1)

wait(1.5)
for startingtime = 100, 1, -1 do
startingtxt = Instance.new("Hint", Workspace)
startingtxt.Text = "Intermission: " ..startingtime
wait(0.1)
game.Workspace.Message:remove()
end

roundstarting = Instance.new("Hint", Workspace)
roundstarting.Text = "Round is starting soon."
wait(2.5)
game.Workspace.Message:remove()

donetimer = Instance.new("Hint", Workspace)
donetimer.Text = "Loading Map."
wait(1)
game.Workspace.Message:remove()
donetimer2 = Instance.new("Hint", Workspace)
donetimer2.Text = "Loading Map.."
wait(1)
game.Workspace.Message:remove()
donetimer3 = Instance.new("Hint", Workspace)
donetimer3.Text = "Loading Map..."
wait(1)
game.Workspace.Message:remove()

mapchosen = Instance.new("Hint", Workspace)
mapchosen.Text = "The map has fully loaded!" ..maps[ranMap] "!"
wait(3)
game.Workspace.Message:remove()
script.Parent.ranMap.name = game.Players.getchildren()
move()
end

Is this ok? (If I get the script wrong, just know I am new at scripting)

1 answer

Replace

ranMap = math.random getmapschildren() (#1)

with

ranMap = math.random(1,#maps)

This code is inefficient. Instead of making a new hint and destroying it, why not edit the text of it?

for startingtime = 100, 1, -1 do
startingtxt = Instance.new("Hint", Workspace)
startingtxt.Text = "Intermission: " ..startingtime
wait(0.1)
game.Workspace.Message:remove()
end

Replace:

for startingtime = 100, 1, -1 do
startingtxt = Instance.new("Hint", Workspace)
startingtxt.Text = "Intermission: " ..startingtime
wait(0.1)
game.Workspace.Message:remove()
end

With:

local NewTxt
function NewRound()
	if NewTxt then
		NewTxt:Destroy()
	end
	NewTxt = Instance.new("Hint",game.Workspace)
	for startingtime = 100, 1, -1 do
		NewTxt.Text = "Intermission: " ..startingtime
		wait(.1)
	end
	--game started
	NewTxt.Text = "Game started"
end

Then edit your other lines to go with that code above. Make sure to call the function NewRound().

This line of code: script.Parent.ranMap.name = game.Players.getchildren()

will error. Please reply to this post what that line is supposed to do.

1 comment

0

Ok thank you

This discussion is preserved as it was. New answers, comments, and votes are closed.