jaydan1
|
  |
| Joined: 13 Jan 2010 |
| Total Posts: 128 |
|
|
| 01 Jul 2012 01:10 PM |
This is my script.
for i, player in pairs(game.Players:GetChildren()) do if player.PlayerGui.Config.IsPlaying.Value == true then Cars = _G.ShownMap.Cars:children() r = math.random(1, #Cars) if Cars[r].Name == "Car" then player[i].Character.Torso.CFrame = CFrame.new(Cars[r].VehicleSeat.Position) + Vector3.new(0,3,0) end end end
In the output it says 1 is not a valid member of player. How do I fix this?
♦Jaydan1♦ |
|
|
| Report Abuse |
|
|
|
| 01 Jul 2012 01:20 PM |
the:
for i, player in pairs() works in a special way. Player is the current value in the sequence, but "i" is the numerical count of the loop. Try no player[i].
Here:
for i, player in pairs(game.Players:GetChildren()) do if player.PlayerGui.Config.IsPlaying.Value == true then Cars = _G.ShownMap.Cars:children() r = math.random(1, #Cars) if Cars[r].Name == "Car" then player.Character.Torso.CFrame = CFrame.new(Cars[r].VehicleSeat.Position) + Vector3.new(0,3,0) end end end
|
|
|
| Report Abuse |
|
|
jaydan1
|
  |
| Joined: 13 Jan 2010 |
| Total Posts: 128 |
|
|
| 01 Jul 2012 01:23 PM |
If I do that will everybody be teleported to the same car?
♦Jaydan1♦ |
|
|
| Report Abuse |
|
|
jaydan1
|
  |
| Joined: 13 Jan 2010 |
| Total Posts: 128 |
|
|
| 01 Jul 2012 01:29 PM |
Nevermind I found a solution.
♦Jaydan1♦ |
|
|
| Report Abuse |
|
|