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: Teleport not working?

Previous Thread :: Next Thread 
MattDominator is not online. MattDominator
Joined: 20 Oct 2008
Total Posts: 3981
28 Apr 2016 02:18 AM
Here's my script to teleport the player to a reserved server:

Grave.Enter.ClickDetector.MouseClick:connect(function(Player)
local Data = game.ServerScriptService:FindFirstChild(Player.Name)
Data.Value = string.sub(Data.Value,1,88) .. "001" .. string.sub(Data.Value,92)
DataStore:SetAsync("Stats" .. Player.userId, Data.Value)
local Code = TeleportService:ReserveServer(game.PlaceId)
print(Code)
wait(5)
TeleportService:TeleportToPrivateServer(game.PlaceId,Code,Player) -- Error Line
end)

For some reason I keep getting the error: "Unable to cast value to Objects".

No idea what this means. Code prints fine, but what object am I trying to cast a value to? There shouldn't be an error because I got it right from the wiki:

http://wiki.roblox.com/index.php?title=API:Class/TeleportService/ReserveServer

Any ideas what I did wrong?
Report Abuse
scottmike0 is not online. scottmike0
Joined: 14 Sep 2008
Total Posts: 1073
28 Apr 2016 02:22 AM
means that you are trying to get a number out of a player or a car, by harming
Report Abuse
MattDominator is not online. MattDominator
Joined: 20 Oct 2008
Total Posts: 3981
28 Apr 2016 02:27 AM
"means that you are trying to get a number out of a player or a car, by harming"

Could you explain what that means please? I'm not sure what a car is or by harming.
Report Abuse
scottmike0 is not online. scottmike0
Joined: 14 Sep 2008
Total Posts: 1073
28 Apr 2016 02:30 AM
in programming there is objects, and then there is variables beneath those objects
in lua, if you wanted to get a value from an object you would usually do object.data or something similar

so from your error message, you are trying to compare an object, something that holds variables to a mere value.
Therefore that is why your code is failing.
Report Abuse
MattDominator is not online. MattDominator
Joined: 20 Oct 2008
Total Posts: 3981
28 Apr 2016 02:36 AM
Thank you for explaining.

In that case though, the error makes no sense. I'm not trying to compare any objects to values.
Report Abuse
MattDominator is not online. MattDominator
Joined: 20 Oct 2008
Total Posts: 3981
28 Apr 2016 03:13 AM
TeleportService:TeleportToPrivateServer(game.PlaceId,Code, >Player< )

So apparently the variable for player was supposed to be an array. Should've listened to you :P
Report Abuse
scottmike0 is not online. scottmike0
Joined: 14 Sep 2008
Total Posts: 1073
28 Apr 2016 03:20 AM
congrats
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