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