|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|