|
| 08 May 2013 10:57 PM |
There acually is no producable error in this, it just doesnt work right :/ It teleports the judges but doesnt teleport the other players, I tried this on a server with 4 people, (Local server).
workspace = game.Workspace lighting = game.Lighting Players = game.Players folder = script.Parent maps = game.Lighting.Maps:GetChildren() map_chosen = folder["Map_Chosen"] gameRunning = folder["GameRunning"] players = {} NORMplayers = {}
--[[Functions]]-- function gatherPlayers() local Player = Players:GetPlayers() for i = 1, #Player do table.insert(players,Player[i].Name) end end --[[Judges]]-- Error probably below function makeJudges() gatherPlayers() local Player = Players:GetPlayers() for i = 1, #Player do table.insert(NORMplayers, Player[i].Name) table.remove(NORMplayers, jug) end end
function moveJudges() for i = 1, #NORMplayers do game.Players[NORMplayers[i]].Character:MoveTo(Vector3.new(-57, 1.8, 43)) end end ---XX-----XX---Error Probably in up top
--[[Jug Functions]] function makeJug() gatherPlayers() return players[math.random(#players)] end
function moveJug() jug = makeJug() game.Players[jug].Character:MoveTo(Vector3.new(-21, 10, 99)) end --XX------------XX-- --[[Main Program]]-- while true do wait(1) print("Creating jug, Creating Judges") wait(2) print("Moving Jug, Moving Judges") wait(2) moveJug() wait(1) moveJudges() end
(ง'̀-'́)ง |
|
|
| Report Abuse |
|
|
|
| 08 May 2013 11:01 PM |
"table.remove(NORMplayers, jug)" What is jug?
Also, table.remove only works with the index. table.remove(Table, 1) -- will work table.remove(Table, "Hi") -- will not work |
|
|
| Report Abuse |
|
|
|
| 08 May 2013 11:04 PM |
I know what you mean, but what Im trying to do is remove player that is a jug, it could be any number of the tables index.
(ง'̀-'́)ง |
|
|
| Report Abuse |
|
|
|
| 08 May 2013 11:16 PM |
Okay, say this is the juggernauts:
Juggernauts = {"Player1"; "Player2"}
And say Player1 and Player 3 die.
--player died connection for _, Juggernaut in next, Juggernauts do if Juggernaut == Player.Name then table.remove(Juggernauts, _) end end --end player died connection |
|
|
| Report Abuse |
|
|
|
| 08 May 2013 11:33 PM |
Thank you, but that is not what Im trying to get at. Say I a variable that was "Jug" and a table named "Players", and I wanted to remove the jug from the table so I could teleport the players, how would I do that?
(ง'̀-'́)ง |
|
|
| Report Abuse |
|
|
|
| 08 May 2013 11:40 PM |
Variable = "This is a variable"
Table = {"I'm in a table", "This is a variable"}
for _, V in next, Table do if (V == Variable) then table.remove(Table, _) end end |
|
|
| Report Abuse |
|
|
| |
|