local TS = game:GetService("TeleportService") local Players = game:GetService("Players") local code = TS:ReserveServer(1144760042) local players = Players[HostName.Value].userId -- StringValue TS:TeleportToPrivateServer(1144760042,code,players)
Can anyone help with this? I can't get around this issue
Error: Unable to cast value to Objects < TS:TeleportToPrivateServer(1144760042,code,players)
Edit:
void TeleportToPrivateServer ( int placeId, string reservedServerAccessCode, array<Player> players, string spawnName = "", Variant teleportData, ScreenGui customLoadingScreen = nil )
TeleportToPrivateServer calls for an array of Player, an Object, not an array of userIds. Pass an array of players to the function;
players = {}; table.insert(players, game.Players[Hostname.Value]); TS:TeleportToPrivateServer(placeid, code, players);