xandon
|
  |
| Joined: 31 Jul 2008 |
| Total Posts: 1037 |
|
|
| 24 Jun 2013 01:34 PM |
function onTouched(hit) friend = script.Parent.Friends enimy = script.Parent.Enimies a = script.Parent.Parent.Flag b = game.Players:GetPlayerFromCharacter(hit.Parent) if b.TeamColor == a.BrickColor then friend.Value = friend.Value + 1 end if b.TeamColor ~= a.BrickColor then enimy.Value = enimy.Value + 1 end end script.Parent.Touched:connect(onTouched)
"Attempt to index global 'b' (a nil value)"
I don't understand what I've done wrong. |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 24 Jun 2013 01:35 PM |
| game.Players:GetPlayerFromCharacter(hit.Parent) does not exist. |
|
|
| Report Abuse |
|
|
|
| 24 Jun 2013 02:01 PM |
function onTouched(hit)
print("Hit: ", hit)
friend = script.Parent.Friends enimy = script.Parent.Enimies a = script.Parent.Parent.Flag b = game.Players:GetPlayerFromCharacter(hit.Parent)
if b ~= nil -- if not a bullet or some mud -- might help
if b.TeamColor == a.BrickColor then friend.Value = friend.Value + 1 end if b.TeamColor ~= a.BrickColor then enimy.Value = enimy.Value + 1 end
end -- Player?
end -- func script.Parent.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|