while true do
wait(1)
print ("Detect")
local Players = game.ServerScriptService.Waiting:GetChildren()
if #Players >= 1 then
game.ServerScriptService.Info.Value = "Intermission..."
--wait (10)
local Players = game.ServerScriptService.Waiting:GetChildren()
if #Players >= 1 then
for i = 1, #Players do
if game.Players:FindFirstChild(Players[i].Name) ~= nil then
if game.Players[Players[i].Name].Waiting.Value == true then
local a = Instance.new ("ObjectValue")
a.Name = Players[i].Name
a.Value = Players[i]
a.Parent = game.ServerScriptService.Vertified
end
end
end
local a = game.ServerScriptService.Waiting:GetChildren()
for i = 1, #a do
a[i]:Destroy()
end
local TS = game:GetService("TeleportService")
local code = TS:ReserveServer(1943783356)
wait()
local b = game.ServerScriptService.Vertified:GetChildren()
for o = 1, #a do
player = b[o].Value
print (player:GetFullName())--Outputs "shanethegamer142"(my user name)
TS:TeleportToPrivateServer(1943783356,code,player)--errors "unable to Cast value to objects"
end
end
else
game.ServerScriptService.Info.Value = "Need More Players"
end
end
✓ ANSWER ACCEPTED
My game join script isnt working any help? (unable to cast value)
1 answer
✓ Accepted answer
TeleportToPrivateServer requires an array of players not the indavidual player which is why you are getting that error.
Assuming that b[o].Value is a player instance then you should built a array instead.
Exalple:-
...
local TS = game:GetService("TeleportService")
local itms = game.ServerScriptService.Vertified:GetChildren()
local plrList = {}
for i = 1, #itms do
plrList[#plrList+1] = itms[i].Value
end
-- tepeort using the array
TS:TeleportToPrivateServer(1943783356,TS:ReserveServer(1943783356) , plrList )
I hope this helps.
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
will it work even if there is only 1 player?
Yes as long as you pass an array of player instances.
im getting a error TeleportService;TeleportToPrivateServer must be passed an array of players
make sure that your object values in Vertified holds the player instance
yep it works now dude thx so much