I have this lobby where I teleport players who are stepping on a certain brick, and after a certain time (like if the time runs out), they will be teleported to a "PrivateServer".

I'm getting an error on line 13 where it tells me "Unable to cast value to object", I don't know why, but I also have this "PlayerFolder" which I store players who step on the brick.

local teleportService = game:GetService("TeleportService")
local arenaPlaceTemplateId = 2090149229
local PrivateServer = teleportService:ReserveServer(arenaPlaceTemplateId)
 
local Model = script.Parent
local PlayerFolder = Model.Players

repeat wait() until script.Disabled == false
	
for _, player in pairs(PlayerFolder:GetChildren()) do
	for i, c in pairs(game.Players:GetPlayers()) do
		if c.Name == player.Name then
			teleportService:TeleportToPrivateServer(arenaPlaceTemplateId, PrivateServer, c)
		end
	end	
end

Thanks,

LukeGabrieI

2 comments

1

I believe the third argument is a table. Try {c}

0

thanks boss