CrniOrao
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 2274 |
|
|
| 10 Jul 2011 01:46 PM |
I have fixed it half-a way... But now there is no output and i can't work with it anymore, so I need your help now. I marked where it works to.
Here's the script:
while true do wait(60*2) m = Instance.new("Message", Workspace) m.Text = "Its Time For Payment... Everyone Who Has A Job Gets 70 Cash, Visitors Get 35 Cash." wait(4) m:Remove() job = game.Workspace.Jobs for i = 1, #p do --Works till here, all below won't work and this line won't work. local TC = p[i].TeamColor if TC == job.Job1 or TC == job.Job2 or TC == job.Job3 then p[i].leaderstats.Money.Value = p[i].leaderstats.Money.Value + 70 elseif TC == job.Job4 then p[i].leaderstats.Money.Value = p[i].leaderstats.Money.Value + 35 elseif TC == job.Job5 then p[i].leaderstats.Money.Value = p[i].leaderstats.Money.Value + 150 end end end
Thanks 4 Help! |
|
|
| Report Abuse |
|
|
CrniOrao
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 2274 |
|
| |
|
Shobobo99
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 5754 |
|
|
| 10 Jul 2011 01:49 PM |
while true do wait(60*2) m = Instance.new("Message", Workspace) m.Text = "Its Time For Payment... Everyone Who Has A Job Gets 70 Cash, Visitors Get 35 Cash." wait(4) m:Remove() job = game.Workspace.Jobs for i = 1, #p do --Works till here, all below won't work and this line won't work. local TC = p[i].TeamColor if TC == job.Job1 or TC == job.Job2 or TC == job.Job3 then p[i].leaderstats.Money.Value = p[i].leaderstats.Money.Value + 70 elseif TC == job.Job4 then p[i].leaderstats.Money.Value = p[i].leaderstats.Money.Value + 35 elseif TC == job.Job5 then p[i].leaderstats.Money.Value = p[i].leaderstats.Money.Value + 150 end end end
Is "p" a defined table? Is job.Job1 a BrickColor value? |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2011 01:49 PM |
You never defined p :P
while true do wait(60*2) m = Instance.new("Message", Workspace) m.Text = "Its Time For Payment... Everyone Who Has A Job Gets 70 Cash, Visitors Get 35 Cash." wait(4) m:Remove() job = game.Workspace.Jobs p = game.Players.GetPlayers() for i = 1, #p do --Works till here, all below won't work and this line won't work. local TC = p[i].TeamColor if TC == job.Job1 or TC == job.Job2 or TC == job.Job3 then p[i].leaderstats.Money.Value = p[i].leaderstats.Money.Value + 70 elseif TC == job.Job4 then p[i].leaderstats.Money.Value = p[i].leaderstats.Money.Value + 35 elseif TC == job.Job5 then p[i].leaderstats.Money.Value = p[i].leaderstats.Money.Value + 150 end end end |
|
|
| Report Abuse |
|
|
Shobobo99
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 5754 |
|
|
| 10 Jul 2011 01:49 PM |
| I didnt mean to post the script sorry. |
|
|
| Report Abuse |
|
|
CrniOrao
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 2274 |
|
|
| 10 Jul 2011 01:50 PM |
job.Job1 is a BrickColorValue
I forgot to define p i think ._. |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2011 01:50 PM |
| I was semi-ninja'd by shobobo |
|
|
| Report Abuse |
|
|
CrniOrao
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 2274 |
|
|
| 10 Jul 2011 01:51 PM |
@Dragon
Neither your will work cuze you defined p uncorrectly. But thanks i know how to fix it now. |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2011 01:52 PM |
I defined it incorrectly? How so? Was it not players that you're trying to loop through? oh well. |
|
|
| Report Abuse |
|
|
Shobobo99
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 5754 |
|
|
| 10 Jul 2011 01:52 PM |
if the children of "job" are BrickColorValues then you need to get the Value of them.
while true do wait(60*2) m = Instance.new("Message", Workspace) m.Text = "Its Time For Payment... Everyone Who Has A Job Gets 70 Cash, Visitors Get 35 Cash." wait(4) m:Remove() job = game.Workspace.Jobs local p = game.Players:GetPlayers() for i = 1, #p do local TC = p[i].TeamColor if TC == job.Job1.Value or TC == job.Job2.Value or TC == job.Job3.Value then p[i].leaderstats.Money.Value = p[i].leaderstats.Money.Value + 70 elseif TC == job.Job4.Value then p[i].leaderstats.Money.Value = p[i].leaderstats.Money.Value + 35 elseif TC == job.Job5.Value then p[i].leaderstats.Money.Value = p[i].leaderstats.Money.Value + 150 end end end
|
|
|
| Report Abuse |
|
|
CrniOrao
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 2274 |
|
|
| 10 Jul 2011 01:53 PM |
You wrote like this:
game.Players.GetPlayer()
As i know it is suposed to be like this:
game.Players:GetPlayer() -- its not . but : at GetPlayer() |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2011 01:54 PM |
| Ah, sorry, I've been coding in Java all day today, and it uses a . to use methods. |
|
|
| Report Abuse |
|
|
CrniOrao
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 2274 |
|
|
| 10 Jul 2011 01:55 PM |
No problem :P
Thanks for help, works fine now. |
|
|
| Report Abuse |
|
|