Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Will this Intermission Script work?

Asked by 9 years ago
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

Log in to vote
3
Answered by
Tigerism 220 Moderation Voter
9 years ago

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.

0
Ok thank you xMinerHaven 0 — 9y
Ad

Answer this question