generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Tried to call a function, got this error

Previous Thread :: Next Thread 
Vampyroteuthiss is not online. Vampyroteuthiss
Joined: 17 Jun 2010
Total Posts: 11541
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
wonderful72pike is not online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
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
Vampyroteuthiss is not online. Vampyroteuthiss
Joined: 17 Jun 2010
Total Posts: 11541
11 Dec 2015 09:15 PM
Im fairly certain the function exists,
Report Abuse
wonderful72pike is not online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
11 Dec 2015 09:25 PM
For some reason your script isn't. Can you post it here?
Report Abuse
thegoodpuppy is not online. thegoodpuppy
Joined: 07 Jul 2011
Total Posts: 2737
11 Dec 2015 09:29 PM
^
Report Abuse
Vampyroteuthiss is not online. Vampyroteuthiss
Joined: 17 Jun 2010
Total Posts: 11541
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 is not online. 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 is not online. 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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
13 Dec 2015 04:13 PM
No, you can use MoveTo for Humanoids as well. They are two separate functions.
Report Abuse
QueenByte is not online. 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 is not online. 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 is not online. QueenByte
Joined: 22 Sep 2015
Total Posts: 20
13 Dec 2015 04:16 PM
Ah okay
Report Abuse
Aethex is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image