|
| 11 Dec 2015 04:08 PM |
17:06:12.660 - Workspace.PlayerChoose:19: attempt to call global 'teleport' (a nil value)
what does this mean? how can it be avoided? |
|
|
| Report Abuse |
|
|
|
| 11 Dec 2015 04:10 PM |
| It means you're trying to use a variable that doesn't exist. It can be avoided by making sure it does exist. |
|
|
| Report Abuse |
|
|
|
| 11 Dec 2015 09:15 PM |
| Im fairly certain the function exists, |
|
|
| Report Abuse |
|
|
|
| 11 Dec 2015 09:25 PM |
| For some reason your script isn't. Can you post it here? |
|
|
| Report Abuse |
|
|
| |
|
|
| 13 Dec 2015 04:07 PM |
print("Player Chooser ready")
local itStart = Vector3.new(0, 900, 0) local playerStart = Vector3.new(100, 10, 10) while (game.workspace.GameReady.Value ~= true) do wait(1) end gameReady = false print("Ready for action")
local playerArray = game.Players:GetPlayers() local gameReady = game.Workspace.GameReady.Value
game.Workspace.playerIT.Value = playerArray[math.random(table.getn(playerArray) + 1)].Name local playerit = game.Workspace:FindFirstChild(game.Workspace.playerIT.Value) print(playerit)
function teleport(it, location) it.Character.Humanoid:MoveTo(location) print("Player was teleported to IT") end
teleport(game.Workspace.playerIT.Value, itStart)
for index,player in pairs(playerArray) do if (playerArray[index].Name ~= playerit.Name) then playerArray[index].Character.Torso.Position = playerStart end print("Player was teleported to PLAYER") end
|
|
|
| Report Abuse |
|
|
QueenByte
|
  |
| Joined: 22 Sep 2015 |
| Total Posts: 20 |
|
|
| 13 Dec 2015 04:10 PM |
function teleport(it, location) it.Character.Humanoid:MoveTo(location) print("Player was teleported to IT") end
teleport(game.Workspace.playerIT.Value, itStart)
You are teleporting something called Value in the player.
Do
function teleport(it, location) it.Character.Humanoid:MoveTo(location) print("Player was teleported to IT") end teleport(game.Players.playerIT, itStart) |
|
|
| Report Abuse |
|
|
QueenByte
|
  |
| Joined: 22 Sep 2015 |
| Total Posts: 20 |
|
|
| 13 Dec 2015 04:11 PM |
Sorry. You can only call :MoveTo() on a model
function teleport(it, location) it.Character:MoveTo(location) print("Player was teleported to IT") end teleport(game.Players.playerIT, itStart) |
|
|
| Report Abuse |
|
|
|
| 13 Dec 2015 04:13 PM |
| No, you can use MoveTo for Humanoids as well. They are two separate functions. |
|
|
| Report Abuse |
|
|
QueenByte
|
  |
| Joined: 22 Sep 2015 |
| Total Posts: 20 |
|
|
| 13 Dec 2015 04:13 PM |
| I have never seen a script with :MoveTo() on a Humanoid |
|
|
| Report Abuse |
|
|
Aethex
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 2193 |
|
|
| 13 Dec 2015 04:16 PM |
| MoveTo() on Humanoids causes the character to attempt walking there. It is an entirely different function. |
|
|
| Report Abuse |
|
|
QueenByte
|
  |
| Joined: 22 Sep 2015 |
| Total Posts: 20 |
|
| |
|
Aethex
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 2193 |
|
|
| 13 Dec 2015 04:17 PM |
| But given the print statement "The player was teleported to IT" infers that it should have been used on the model. |
|
|
| Report Abuse |
|
|
76km
|
  |
| Joined: 14 Aug 2015 |
| Total Posts: 5455 |
|
|
| 13 Dec 2015 04:18 PM |
You are calling a non existent variable.
That means,
If there are 0 players. and you ask the script to find 1 player.
Well then It can't, and it says that players are nil. |
|
|
| Report Abuse |
|
|