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

Message command not ending/showing?

Asked by 7 years ago

Hello people!

So I have a message that is played 21 seconds after someone joins. The problem is, I can't stop the final message from being only a couple seconds and then disappearing.

01local msg = Instance.new("Message")
02msg.Parent = Workspace
03wait (21)
04msg.Text = "The game will be starting in..."
05wait (5)   
06msg.Text = "5"
07wait (1)   
08msg.Text = "4"
09wait (1)
10msg.Text = "3"
11wait (1)
12msg.Text = "2"
13wait (1)
14msg.Text = "1"
15wait (1)
16msg.Text = "TELEPORTING PLAYERS"
17wait (1)

I have tried putting "end" at the end. But it won't show up in the first place.

01local msg = Instance.new("Message")
02msg.Parent = Workspace
03wait (21)
04msg.Text = "The game will be starting in..."
05wait (5)   
06msg.Text = "5"
07wait (1)   
08msg.Text = "4"
09wait (1)
10msg.Text = "3"
11wait (1)
12msg.Text = "2"
13wait (1)
14msg.Text = "1"
15wait (1)
16msg.Text = "TELEPORTING PLAYERS"
17wait (1)
18end

I've also tried this

01local msg = Instance.new("Message")
02msg.Parent = Workspace
03wait (21)
04msg.Text = "The game will be starting in..."
05wait (5)   
06msg.Text = "5"
07wait (1)   
08msg.Text = "4"
09wait (1)
10msg.Text = "3"
11wait (1)
12msg.Text = "2"
13wait (1)
14msg.Text = "1"
15wait (1)
16msg.Text = "TELEPORTING PLAYERS"
17wait (1)
18m:Remove()
19end

Help and thanks.

1 answer

Log in to vote
0
Answered by
Azarth 3141 Moderation Voter Community Moderator
7 years ago
Edited 7 years ago

This is based on the assumption that there are no other parts to this script. So, technically, yes, your script would play, but only after the first person to ever start that particular server joins the game. It will never play again after that. Also, your script doesn't correctly start when a player joins, it starts when the server starts. This means that the player most likely won't see the entire message since your script will load before the player does. For a very basic setup, you're going to need tick() to account for the time passed since the server started (since someone did join to start it) and a while loop to keep running your game. You also need to take into account that the first person who joined may have left within 21 seconds of your first message, so go ahead and make sure there's someone even in the game to start it.

01local msg = Instance.new("Message", workspace)
02 
03local minimumPlayers = 1
04local startCount = 5
05local stopCount = 0
06local incBy = -1
07-- You can also do this => local startCount, stopCount, incBy = 5, 0, -1
08local pause = 1 -- your wait between messages
09local serverStartTime = tick()
10local delayedStart = 21
11 
12 
13 
14local function start()
15    msg.Parent = workspace
View all 40 lines...
Ad

Answer this question