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

Minigame script teleporting 1 only, how do i fix?

Asked by 10 years ago

Ok so heres the deal. Please reply or send my real account (which is banned tell tuesday thats why im here) iamnoamesa a message. So i have my minigame as to teleport a player. the problem as theres a function while true do , what ends up happening is it teleports a player, waits 120 seconds then goes on. i need to teleport all. i played around with it but please help me correct this. this is one of the minigames: while true do --This makes sure it keeps going and doesn't die out on us wait(5) --This is how long until the games are started. Recomended that you keep to 5 local m = math.random(1,3) --This randomly selects a game. The seven shows how many games there are local player = game.Players:GetPlayers() for i = 1, #player do --This checks for players and gets them a = 1, #player do b = 1, #player do c = 1, #player do end end msg = Instance.new("Hint") --This make the annoying messages that appear on you screen msg.Parent = nil --This identifies the game if m == 1 then --don't change unless you know what you are doing msg.Parent = game.Workspace --This makes sure it says and appears in the workspace msg.Text = "Choosing Map." --A bunch of messages to tell you that the game is starting which you can change if desired wait(1) msg.Text = "Choosing Map.." wait(1) msg.Text = "Choosing Mode..." wait(1) msg.Text = "A Map and mode has been chosen" wait(3) msg.Text = "The Map and mode's are..." wait(3) msg.Text = "Haunted house - Coloured keys!" --Put the name of the minigame you want it to be called wait(2) msg.Text = "Find the three keys to access the teleporter within the time limit!" --Put the rules of the minigame wait(5) msg.Text = "The game will be starting in:" wait(1) msg.Text = "...3..." wait(1) msg.Text = "..2.." wait(1) msg.Text = ".1." wait(1) msg.Text = "Begin!" wait(1) msg:remove() game.Lighting.Mini1:clone().Parent = game.Workspace player[i].Character:MoveTo(Vector3.new(150.5, 55, 219)) player[a].Character:MoveTo(Vector3.new(150.5, 60, 219)) player[b].Character:MoveTo(Vector3.new(150.5, 65, 219)) player[c].Character:MoveTo(Vector3.new(150.5, 70, 219)) wait(120) --How long the game lasts msg.Parent = game.Workspace msg.Text = "times up!" --After the game ends, this shows a message/messages at the end. Edit if you want. wait(3) msg:remove() game.Workspace.Mini1:Remove() --Removes the brick so all players die (except spectators) and removes the brick so a new game can start (recommended games aren't over 5 minutes so spectators aren't bored) end if m == 2 then --and so on

what it used to be is at the beginning its i = 1, #player do then it goes like player[i].character:moveto(Vector3.new(150.5,70,219)) wait(120) --now what happend is only 1 player got teleported. I also just realized i have to move the torso not the character. Any help? Or can someone give me a minigame script that just works good and tell me what i have wrong in here?

1
Put your code in code block please. Goulstem 8144 — 10y

2 answers

Log in to vote
0
Answered by 10 years ago

**Use : **

for _,v in pairs(game.Players:GetPlayers()) do
    if v then 
        v.Character:MoveTo(Vector3.new(150.5,70,219))
    end
end

Instead of :

i = 1, #player do
player[i].character:moveto(Vector3.new(150.5,70,219)) 
wait(120)
0
But because of the while true do they will just end up keep getting teleported. dont i need a wait (120) Then an end? ima add a wait but lets see, thanks il see if it works iamnoamisa 25 — 10y
Ad
Log in to vote
1
Answered by 10 years ago

lemme make this better. First code:

while true do --This makes sure it keeps going and doesn't die out on us 
wait(5) 
 local m = math.random(1,3) --This randomly selects a game. The 3 shows how many games there are 
local player = game.Players:GetPlayers() 
for i = 1, #player do
       a = 1, #player do 
b = 1, #player do 
c = 1, #player do end end msg = Instance.new("Hint") --This make the annoying messages that appear on you screen 
msg.Parent = nil --This identifies the game 
if m = 1 then 
msg.Parent = game.Workspace --This makes sure it says and appears in the workspace msg.
Text = "Choosing Map." --A bunch of messages to tell you that the game is starting which you can change if desired 
wait(1)
 msg.Text = "Choosing Map.." 
wait(1)
 msg.Text = "Choosing Mode..." 
wait(1) 
msg.Text = "A Map and mode has been chosen" 
wait(3) 
msg.Text = "The Map and mode's are..." 
wait(3) 
msg.Text = "Haunted house - Coloured keys!"
wait(2)
 msg.Text = "Find the three keys to access the teleporter within the time limit! 
wait(5)
 msg.Text = "The game will be starting in:"
 wait(1) 
msg.Text = "...3..."
wait(1)
 msg.Text = "..2.." 
wait(1) 
msg.Text = ".1."
 wait(1) 
msg.Text = "Begin!" 
wait(1) 
msg:remove() 
game.Lighting.Mini1:clone().Parent = game.Workspace player[i].Character:MoveTo(Vector3.new(150.5, 55, 219)) player[a].Character:MoveTo(Vector3.new(150.5, 60, 219)) player[b].Character:MoveTo(Vector3.new(150.5, 65, 219)) player[c].Character:MoveTo(Vector3.new(150.5, 70, 219)) 
wait(120) 
msg.Parent = game.Workspace msg.Text = "times up!" --After the game ends, this shows a message/messages at the end. 
 wait(3) 
msg:remove()
 game.Workspace.Mini1:Remove() --Removes the brick so all players die (except spectators) and removes the brick so a new game can start 
 end 
if m == 2 
then --and so on

second code i showed

i = 1, #player do
player[i].character:moveto(Vector3.new(150.5,70,219)) 
wait(120)

Idk is this more clear sorry im rusty on this site

0
sorry messed up on showing it , it isnt all green lol iamnoamisa 25 — 10y
0
You can just use the "Edit" button, but I don't understand why 99% of your code is commented out. Perci1 4988 — 10y
0
Ok sorry i missed up now dcan someone help me with teh CODE not saying it as its comment lol iamnoamisa 25 — 10y
0
here i edited it now is it better :) iamnoamisa 25 — 10y

Answer this question