miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 02 Jan 2012 04:44 PM |
pcall(function() if game.Workspace:FindFirstChild("Round")~=nil and game.Workspace.Round.Text == "You have 3 seconds until the match" then game.Players(_G.myTable[math.random(2,#_G.myTable)]).Character.Torso.CFrame = CFrame.new(0,0,0) end end)
I don't know. Is my table messed up?
_G.myTable = {} game.Players.PlayerAdded:connect(function(p) table.insert(_G.myTable,p.Name) end) game.Players.PlayerRemoving:connect(function(r) for i,v in next, _G.myTable do if v == r.Name then table.remove(_G.myTable, i) break end end end)
|
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
| |
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 02 Jan 2012 05:23 PM |
| Guess what? Guess what? Bump says the ring tone. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 02 Jan 2012 06:01 PM |
| Bumpity bump, look at that frosty go! |
|
|
| Report Abuse |
|
|
Kizran
|
  |
| Joined: 01 Jan 2012 |
| Total Posts: 33 |
|
|
| 02 Jan 2012 06:09 PM |
| What are we looking for? Is it not executing? Not doing something correctally? |
|
|
| Report Abuse |
|
|
|
| 02 Jan 2012 06:19 PM |
_G.myTable = {} game.Players.PlayerAdded:connect(function(p) table.insert(_G.myTable,p.Name) end) game.Players.PlayerRemoving:connect(function(r) for i = 1, #G.myTable do if v == r.Name then table.remove(_G.myTable, i) break end end end) |
|
|
| Report Abuse |
|
|
Biostream
|
  |
| Joined: 28 Mar 2011 |
| Total Posts: 913 |
|
|
| 02 Jan 2012 06:22 PM |
pcall(function() if game.Workspace:FindFirstChild("Round")~=nil then if game.Workspace.Round.Text == "You have 3 seconds until the match" then game.Players(_G.myTable[math.random(2,#_G.myTable)]).Character.Torso.CFrame = CFrame.new(0,0,0) end end end)
You were checking to see if an object exists and indexing a property of it. If the object doesn't exist, this will not run. You need consecutive if statements
|
|
|
| Report Abuse |
|
|
|
| 02 Jan 2012 06:39 PM |
pcall(function() if game.Workspace:FindFirstChild("Round")~=nil then if game.Workspace.Round.Text == "You have 3 seconds until the match" then game.Players(_G.myTable[math.random(2,#_G.myTable)]).Character.Torso.CFrame = CFrame.new(0,0,0) end) end end
Try that. Or this:
pcall(function() if game.Workspace:FindFirstChild("Round")~=nil then if game.Workspace.Round.Text == "You have 3 seconds until the match" then game.Players(_G.myTable[math.random(2,#_G.myTable)]).Character.Torso.CFrame = CFrame.new(0,0,0) end end) end |
|
|
| Report Abuse |
|
|
|
| 02 Jan 2012 06:40 PM |
WAIT
TRY THIS
pcall(function()) if game.Workspace:FindFirstChild("Round")~=nil then if game.Workspace.Round.Text == "You have 3 seconds until the match" then game.Players(_G.myTable[math.random(2,#_G.myTable)]).Character.Torso.CFrame = CFrame.new(0,0,0) end end end |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
| |
|
Legend26
|
  |
| Joined: 08 Sep 2008 |
| Total Posts: 10586 |
|
|
| 02 Jan 2012 06:50 PM |
This line stands out: "game.Players(_G.myTable[math.random(2,#_G.myTable)]).Character.Torso.CFrame = CFrame.new(0,0,0)"
To index a table, which is what you're doing there, you need to use the '[' and ']' characters which changes that line to this: game.Players[_G.myTable[math.random(2,#_G.myTable)]].Character.Torso.CFrame = CFrame.new(0,0,0)
Additionally, why are you starting the random choice at two instead of one? This means that one of the players will never be chosen until another enters the game. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 02 Jan 2012 07:01 PM |
Still doesn't work.
pcall(function() if game.Workspace:FindFirstChild("Round")~=nil and game.Workspace.Round.Text == "You have 3 seconds until the match." then game.Players[_G.myTable[math.random(1,#_G.myTable)]].Character.Torso.CFrame = CFrame.new(0,0,0) game.Players[_G.myTable[math.random(1,#_G.myTable)]].Character.Torso.CFrame = CFrame.new(0,10,0) end end)
|
|
|
| Report Abuse |
|
|
Legend26
|
  |
| Joined: 08 Sep 2008 |
| Total Posts: 10586 |
|
|
| 02 Jan 2012 07:03 PM |
| Print the pcall, it'll give you the error. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 02 Jan 2012 07:08 PM |
if game.Workspace:FindFirstChild("Round")~=nil and game.Workspace.Round.Text == "You have 3 seconds until the match." then game.Players[_G.myTable[math.random(1,#_G.myTable)]].Character.Torso.CFrame = CFrame.new(0,0,0) game.Players[_G.myTable[math.random(1,#_G.myTable)]].Character.Torso.CFrame = CFrame.new(0,10,0) end
Still doesn't work.
And here's the hint script. If you need to know
while wait() do if game.Players.NumPlayers >=2 then local h = Instance.new("Hint",Workspace) h.Name = "Round" for i = 20,0,-1 do wait(1) h.Text = "You have "..i.." seconds until the match." if h.Text == "You have 0 seconds until the match." then wait(1) for j = 60,0,-1 do wait(1) h.Text = "You have "..j.." seconds until round is over." end wait(10) if game.Players.NumPlayers <=2 then h:Destroy() else end end end end end
|
|
|
| Report Abuse |
|
|
Biostream
|
  |
| Joined: 28 Mar 2011 |
| Total Posts: 913 |
|
|
| 02 Jan 2012 07:56 PM |
| I'm telling you, you need to take what I posted earlier into consideration. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
| |
|
Biostream
|
  |
| Joined: 28 Mar 2011 |
| Total Posts: 913 |
|
|
| 02 Jan 2012 09:03 PM |
| Post what you have right now. All of it |
|
|
| Report Abuse |
|
|
DXPower
|
  |
| Joined: 21 Oct 2008 |
| Total Posts: 2866 |
|
|
| 02 Jan 2012 09:04 PM |
Might want to use xpcall...
Free Fireworks! |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 02 Jan 2012 09:04 PM |
Teleport--Doesn't work
while wait() do for i,v in pairs(game.Workspace:GetChildren()) do if v.Name == "Round" then if v.Text == "You have 0 seconds until the match." then game.Players(_G.myTable[math.random(1,#_G.myTable)]).Character.Torso.CFrame = CFrame.new(0,0,0) game.Players(_G.myTable[math.random(1,#_G.myTable)]).Character.Torso.CFrame = CFrame.new(0,5,0) end end end end
Player added in table--Not sure if works. _G.myTable = {} game.Players.PlayerAdded:connect(function(p) table.insert(_G.myTable,p.Name) end) game.Players.PlayerRemoving:connect(function(r) for i,v in next, _G.myTable do if v == r.Name then table.remove(_G.myTable, i) break end end end)
Countdown--Works
while wait() do if game.Players.NumPlayers >=2 then local h = Instance.new("Hint",Workspace) h.Name = "Round" for i = 20,0,-1 do wait(1) h.Text = "You have "..i.." seconds until the match." if h.Text == "You have 0 seconds until the match." then wait(1) for j = 60,0,-1 do wait(1) h.Text = "You have "..j.." seconds until round is over." end wait(10) if game.Players.NumPlayers <=2 then h:Destroy() else end end end end end |
|
|
| Report Abuse |
|
|
Biostream
|
  |
| Joined: 28 Mar 2011 |
| Total Posts: 913 |
|
|
| 02 Jan 2012 09:14 PM |
Try this.
_G.myTable = {} game.Players.PlayerAdded:connect(function(p) table.insert(_G.myTable, p.Name) end) game.Players.PlayerRemoving:connect(function(r) for i,v in next, _G.myTable do if v == r.Name then table.remove(_G.myTable, i) break end end end)
while wait() do if game.Players.NumPlayers >=2 then local h = Instance.new("Hint",Workspace) h.Name = "Round" for i = 20,0,-1 do wait(1) h.Text = "You have "..i.." seconds until the match." game.Players(_G.myTable[math.random(1,#_G.myTable)]).Character.Torso.CFrame = CFrame.new(0,0,0) game.Players(_G.myTable[math.random(1,#_G.myTable)]).Character.Torso.CFrame = CFrame.new(0,5,0) end wait(1) for j = 60,0,-1 do wait(1) h.Text = "You have "..j.." seconds until round is over." end wait(10) if game.Players.NumPlayers <=2 then h:Destroy() end end end
|
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
| |
|
Biostream
|
  |
| Joined: 28 Mar 2011 |
| Total Posts: 913 |
|
| |
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 03 Jan 2012 10:33 AM |
I fixed this script already :P
Sorry bout that. Forgot to tell you. |
|
|
| Report Abuse |
|
|
Biostream
|
  |
| Joined: 28 Mar 2011 |
| Total Posts: 913 |
|
| |
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 03 Jan 2012 10:35 AM |
| Yep, sorry for not telling. |
|
|
| Report Abuse |
|
|