ayub32
|
  |
| Joined: 27 Dec 2009 |
| Total Posts: 485 |
|
|
| 21 May 2014 07:46 PM |
The output is returning an error on line 21 and I can't seem to find it. The ouput returned Players.Player3.PlayerGui.Spectate.SpectateGUI.LocalScript:21: attempt to index field '?' (a nil value) Here is the script
players = {} cam = game.workspace.CurrentCamera num = 0 players = game.Players:getPlayers() function spectate(human) plr = game.Players:getPlayerFromCharacter(human.Parent) if human.className == "Humanoid" and plr.Playing.Value == true then cam.CameraSubject = human end end script.Parent.Forward.MouseButton1Click:connect(function() num = num + 1 local humanoid = players[num].Character.Humanoid -- script.Parent.Current.Value = humanoid spectate(humanoid) if num == #players then num = 1 end end) script.Parent.Backward.MouseButton1Click:connect(function() num = num-1 local humanoid = players[num].Character.Humanoid -- script.Parent.Current.Value = humanoid spectate(humanoid) if num == 0 then num = #players end end) players = game.Players:getPlayers()
|
|
|
| Report Abuse |
|
|
ayub32
|
  |
| Joined: 27 Dec 2009 |
| Total Posts: 485 |
|
| |
|
ayub32
|
  |
| Joined: 27 Dec 2009 |
| Total Posts: 485 |
|
| |
|
bradz234
|
  |
| Joined: 02 Aug 2009 |
| Total Posts: 31 |
|
|
| 22 May 2014 05:53 AM |
| Its supposed to be .MouseButton1Down, not .MouseButton1Click. |
|
|
| Report Abuse |
|
|