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

Random Number Displayed in Screen Message?

So I have a script that picks a random number and I have a script where I want to apply it. How can I get the random number picked to replace NUMBER on line 2 of the first script below this?

local message = Instance.new('Message', game.Workspace)
message.Text = "Flight NUMBER has arrived!"
wait(3)
message:Destroy()
game.ServerStorage.Plane:Clone().Parent = workspace
wait(30)
game.Workspace.Plane:Destroy()
end

Random Number Script:

for _ = 1, 1 do
	print(math.random(999))
	wait(1)
end

4 comments

0

Sadly, I have to get off, if this isn't answered then I will help tomorrow ;) Hint: create a IntValue that displays the number and the message will check the IntValue for the number

0

BTW in random number script put math.randomseed(tick())

0

It truly randomizes the number

0

Make a variable at the top something like: Local flightnum = math.random(put number you want it to be inbetween here, 999) that would pick the number. Nex  make sure the message is "Flight "..flightnum.." Has Arrived" I believe that should work. If not, my bad.

1 answer

✓ Accepted answer

Use concatenation to concatenate a random number to a string.

message.Text = "Flight #"..math.random(999).." has arrived!"

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