Can anyone help me with my script? I have a timer and it counts down from 0, then it is going to teleport all the players in the game to that brick. Can you help me?
local players = game.Players:GetPlayers() for test1 = 10, 1, -1 do test2 = Instance.new("Hint", game.Workspace) test2.Text = "There is " ..test1.. " seconds left" wait(1) game.Workspace.Message:remove() wait(1) players.Character:MoveTo(game.Workspace.SpeedBrick.Position) end
Using Dyler3's script, I'll edit it a little, the problem is with the dead variable not updating. Don't use the players
variable.
local test2 = Instance.new("Hint", workspace) for test1 = 10, 0, -1 do --Replace 10 with how many seconds you want to wait. test2.Text = "There is " ..test1.. " seconds left" wait(1) end game.Workspace.Message:Destroy() for i, v in pairs(game.Players:GetPlayers()) do v.Character:MoveTo(workspace.SpeedBrick.Position) end
Hope it helps!
You have a couple problems with your script. The first is that you used the for statement incorrectly. It would work like this, just not the way you want it to. Your second problem comes in when you're trying to move the players.
Ok, so for the first part, we simply want it to wait one second for each iteration, and then update the text. To do that, we'll shorten the for statement down to this:
local players = game.Players:GetPlayers() for test1 = 10, 1, -1 do test2 = Instance.new("Hint", game.Workspace) test2.Text = "There is " ..test1.. " seconds left" wait(1) game.Workspace.Message:remove() end
Now that's fixed, and will work how you want it to. Here's for the next part. Here, we'll teleport each player individually to the brick:
wait(1) for _,Player in pairs(players) do Player.Character:MoveTo(game.Workspace.SpeedBrick.Position) end
Now, this should work as well. It is another for statement that iterates over each player, and moves them to the brick. So, let's put it together, and for the final result we get this:
local players = game.Players:GetPlayers() for test1 = 10, 1, -1 do test2 = Instance.new("Hint", game.Workspace) test2.Text = "There is " ..test1.. " seconds left" wait(1) game.Workspace.Message:remove() end wait(1) for _,Player in pairs(players) do Player.Character:MoveTo(game.Workspace.SpeedBrick.Position) end
There ya go
Ok, so now it should work. If you have any further problems/questions, please leave a comment below. Hope I helped :P
for test1 = 10, 0, -1 do test2 = Instance.new("Hint", workspace) test2.Text = "There is " ..test1.. " seconds left" wait(1) end test2:Destroy() for i, v in pairs(game.Players:GetPlayers()) do v.Character:MoveTo(workspace.SpeedBrick.Position) end