Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 06 Aug 2012 01:04 AM |
g = game.Teams.Team:GetChildren() --Change team to which team is the home team. index = #g team = "TRA" if index <= 5 then i = g.Backpack:GetChildren() value = #i i:Remove() a = Instance.new("Message",workspace) print("FivePlayers") a.Text = team.. " needs to have 5 players to start" wait(1) repeat wait() until index >= 5 a:Remove() b = Instance.new("Message", workspace) b.Text = team.. " has enough players now, starting!" wait(5) c = game.Lighting.LinkedSword:Clone() c.Parent = index.Backpack b:Remove() end |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 06 Aug 2012 02:32 AM |
I'll not answer to this Free Model scrpt.
Dang. |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 06 Aug 2012 02:38 AM |
| To make it short, as far as I know, the Players aren't also listed up in the Teams. They're only in the Players and Workspace directory. Well atleast to achieve the BackPack, you would not write it like that. |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 06 Aug 2012 02:44 AM |
| Forget that script. There are several faults. |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
| |
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 06 Aug 2012 02:51 AM |
It's going to become a free model, real script here:
g = game.Teams.RAT:GetChildren() --Change team to which team is the home team. index = #g if index <= 5 then a = Instance.new("Message",workspace) print("5") a.Text = "There needs to be 5 RAT members to start raiding" wait(1) repeat wait() until index >= 5 a:Remove() end |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2012 03:11 AM |
Glad to help. At least you put effort into it.
while Wait(.05) do local g = game.Players:GetChildren() local playersinteam={} local team = "TRA"--Swap with team name. for index, player in ipairs(g) teamisreal=game:GetService("Teams"):FindFirstChild("TRA") if teamisreal then if player.TeamColor==teamisreal.TeamColor then table.insert(playersinteam, player) end end end if #playersinteam < 5 then for i= 1, #playersinteam do local t= playersinteam[i].Backpack:GetChildren() for in, tool in ipairs(t) do tool:Destroy() end end local Acheck=game.Workspace:FindFirstChild("Message") if Acheck then print(".") else a=Instance.new("Message",game.Workspace) end a.Text = team.. " needs to have 5 players to start" wait(5) a:Destroy() else for i, player in ipairs(playersinteam) do local c = game.Lighting.LinkedSword:Clone() c.Parent = player.Backpack end end end
--Pennystalker |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2012 03:12 AM |
Sorry, had a typo.
while Wait(.05) do local g = game.Players:GetChildren() local playersinteam={} local team = "TRA"--Swap with team name. for index, player in ipairs(g) teamisreal=game:GetService("Teams"):FindFirstChild(team) if teamisreal then if player.TeamColor==teamisreal.TeamColor then table.insert(playersinteam, player) end end end if #playersinteam < 5 then for i= 1, #playersinteam do local t= playersinteam[i].Backpack:GetChildren() for in, tool in ipairs(t) do tool:Destroy() end end local Acheck=game.Workspace:FindFirstChild("Message") if Acheck then print(".") else a=Instance.new("Message",game.Workspace) end a.Text = team.. " needs to have 5 players to start" wait(5) a:Destroy() else for i, player in ipairs(playersinteam) do local c = game.Lighting.LinkedSword:Clone() c.Parent = player.Backpack end end end
--Pennystalker |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2012 03:13 AM |
Yet another issue.. Forgot to clear the table...
while Wait(.05) do local g = game.Players:GetChildren() local playersinteam={} local team = "TRA"--Swap with team name. for index, player in ipairs(g) teamisreal=game:GetService("Teams"):FindFirstChild(team) if teamisreal then if player.TeamColor==teamisreal.TeamColor then table.insert(playersinteam, player) end end end if #playersinteam < 5 then for i= 1, #playersinteam do local t= playersinteam[i].Backpack:GetChildren() for in, tool in ipairs(t) do tool:Destroy() end end local Acheck=game.Workspace:FindFirstChild("Message") if Acheck then print(".") else a=Instance.new("Message",game.Workspace) end a.Text = team.. " needs to have 5 players to start" wait(5) a:Destroy() else for i, player in ipairs(playersinteam) do local c = game.Lighting.LinkedSword:Clone() c.Parent = player.Backpack end end playersinteam={} end
--Pennystalker |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 06 Aug 2012 03:22 AM |
teamname = game.Teams:findFirstChild("TEAMNAMEHERE") --Change it to your home-team. Also allows spaces. team = teamname.TeamColor amount = 5 --Change the number to the amount of players, it needs atleast in the team. counter = 0 m = Instance.new("Message", Workspace)
while wait() do if counter < amount then players = game.Players:GetPlayers() for i = 1, #players do if players[i].TeamColor == team.TeamColor then counter = counter + 1 stuff = players[i].BackPack:GetChildren() for e = 1, #stuff do stuff[e]:Destroy() end if counter < amount then m.Message = "" ..teamname.. " needs atleast " ..amount.. " players to start." else m.Message = "Enough players now." wait(5) m.Message = "" c = game.Lighting:findFirstChild("LinkedSword"):clone() --Change the name to the weapon inside Lighting you want to give the team. c.Parent = players[i].BackPack end end end end end
Can't guarantee, that it works. |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2012 03:23 AM |
@Cheater- Message isn't a property of the Message instance. Even though that makes sense :P
It's "Text"
Oh, another thing. Not completely sure about this, but I recall reading that "findFirstChild" is deprecated compared to "FindFirstChild"
--Pennystalker |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2012 03:24 AM |
And the Backpack service (I think it is a service?) only has "B" capitalized.
--Pennystalker |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 06 Aug 2012 03:30 AM |
| :findFirstChild() should still work and yes it is a typo. :C |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 06 Aug 2012 03:31 AM |
Am on a iOS are you sure that yours works..
I wish I had a output for mobile. |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 06 Aug 2012 03:32 AM |
teamname = game.Teams:findFirstChild("TEAMNAMEHERE") --Change it to your home-team. Also allows spaces. team = teamname.TeamColor amount = 5 --Change the number to the amount of players, it needs atleast in the team. counter = 0 m = Instance.new("Message", Workspace)
while wait() do if counter < amount then players = game.Players:GetPlayers() for i = 1, #players do if players[i].TeamColor == team.TeamColor then counter = counter + 1 stuff = players[i].BackPack:GetChildren() for e = 1, #stuff do stuff[e]:Destroy() end if counter < amount then m.Text = "" ..teamname.. " needs atleast " ..amount.. " players to start." else m.Text = "Enough players now." wait(5) m.Text = "" c = game.Lighting:findFirstChild("LinkedSword"):clone() --Change the name to the weapon inside Lighting you want to give the team. c.Parent = players[i].BackPack end end end end end
Here the fix. |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2012 03:33 AM |
No, I'm not sure mine works. Ever-so-sadly, I don't feel like creating a game with the linked sword in the lighting and whatnot.. Whenever you get back to your computer just check it out and analyze the output. I'll help you solve whatever error there may be if you don't understand it.
--Pennystalker |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 06 Aug 2012 03:37 AM |
| Thank you penny and cheater for helping me. |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
| |
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 06 Aug 2012 04:36 PM |
Workspace.Script:16: '< name >' expected near 'in'
line: for in,_ tool in ipairs(t) do |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 06 Aug 2012 04:37 PM |
| @Xnite: Did you mean "for _, tool in ipairs(t) do" (You had a space in there and you can't use "in" as a variable name). |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 06 Aug 2012 04:41 PM |
Than you dr01d.
Now other error..
while Wait(.05) do local g = game.Players:GetChildren() local playersinteam={} local team = "RAT"--Swap with team name. for index, player in ipairs(g)do teamisreal=game:GetService("Teams"):FindFirstChild(team) if teamisreal then if player.TeamColor==teamisreal.TeamColor then table.insert(playersinteam, player) end end end if #playersinteam < 5 then for i= 1, #playersinteam do local t= playersinteam[i].Backpack:GetChildren() for _, tool in ipairs(t) do tool:Destroy() end end local Acheck=game.Workspace:FindFirstChild("Message") if Acheck then print(".") else local msg=Instance.new("Message",game.Workspace) end msg.Text = team.. " needs to have 5 players to start" wait(5) a:Destroy() else for i, player in ipairs(playersinteam) do local c = game.Lighting.LinkedSword:Clone() c.Parent = player.Backpack end end playersinteam={} end
Output: 16:39:55 - Workspace.Script:26: attempt to index global 'msg' (a nil value) 16:39:55 - Script "Workspace.Script", Line 26 16:39:55 - stack end |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 06 Aug 2012 04:46 PM |
| That means you are trying to use the variable "msg", but it hasn't been defined in the scope, meaning it doesn't exist. |
|
|
| Report Abuse |
|
|
1pie23
|
  |
| Joined: 11 Jul 2010 |
| Total Posts: 1865 |
|
|
| 06 Aug 2012 04:46 PM |
while Wait(.05) do local g = game.Players:GetChildren() local playersinteam={} local team = "RAT"--Swap with team name. for index, player in ipairs(g)do teamisreal=game:GetService("Teams"):FindFirstChild(team) if teamisreal then if player.TeamColor==teamisreal.TeamColor then table.insert(playersinteam, player) end end end if #playersinteam < 5 then for i= 1, #playersinteam do local t= playersinteam[i].Backpack:GetChildren() for _, tool in ipairs(t) do tool:Destroy() end end local Acheck=game.Workspace:FindFirstChild("Message") if Acheck then print(".") msg = nil else msg=Instance.new("Message",game.Workspace) end if msg ~= nil then msg.Text = team.. " needs to have 5 players to start" end wait(5) a:Destroy() else for i, player in ipairs(playersinteam) do local c = game.Lighting.LinkedSword:Clone() c.Parent = player.Backpack end end playersinteam={} end |
|
|
| Report Abuse |
|
|
1pie23
|
  |
| Joined: 11 Jul 2010 |
| Total Posts: 1865 |
|
|
| 06 Aug 2012 04:47 PM |
You didn't check. For example:
db = false
if db == true then local a = script.Parent else print("Nope") end
print(a.Name)
Would error, you didn't define a in the else statement. |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 06 Aug 2012 04:49 PM |
| @pie: A would have to be defined completely out of that if and else block, or made in the file scope. |
|
|
| Report Abuse |
|
|