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

How do I setup a countdown, and then move players to a certain location?

Asked by 9 years ago

First I created an Instance to create the Hint, then I created the function, then placed a Loop to serve as the countdown. Like this

for i = 1, 11 do sp.Text = sp.Text -1 wait(1) end When I tried to add when the countdown reaches 0, players move to a certain spot and it doesn't work Please help!

0
Give us your whole code. alphawolvess 1784 — 9y

3 answers

Log in to vote
0
Answered by 9 years ago

You gave us little info, but from what I'm getting from your question, this is what I think you want

for i = 11, 1, -1 do
    sp.Text = i
    wait(1)
end

for i,v in pairs(game.Player:GetChildren()) do
    v.Character:MoveTo() -- put coordinates between the parentheses.
end
0
It saying that it's Unable to cast double to Vector03. What does that mean? ApocalypseRisingV 5 — 9y
Ad
Log in to vote
1
Answered by 9 years ago

We need more information to properly help you (ex what errors are you encountering (check the Output box if in studio or press F9 for the developer console in online mode))? What happens when you run it vs what you want to have happen?), but there is a bug in the code you've shown: you can't do arithmetic on strings. That is, "sp.Text" is a string, but you're trying to subtract 1 from it.

Instead, refer to the 'i' variable, and perhaps have the for loop count down instead of up:

for i = 11, 1, -1 do
    sp.Text = i
    wait(1)
end

(Note that lua automatically converts the number to a string in this case).

Also note that Hints (created via Instance.new("Hint")) are deprecated and could theoretically be removed from Roblox in a future update.

Log in to vote
0
Answered by 8 years ago

i wouldn't do move to because it can cause problems. Just Change the CFrame of the players torsos.

Answer this question