local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")
local RemoteEvent = game.ReplicatedStorage.Teleport
local PlaceId = 5006415599
local code = TS:ReserveServer(PlaceId)
local function Teleport()
TS:TeleportToPrivateServer(PlaceId,code,Players)
end
RemoteEvent.OnServerEvent:Connect(Teleport)
✓ ANSWER ACCEPTED
How to fix my serversided Reserved server?
1 answer
✓ Accepted answer
I don't know about TeleportService, but I hope this works.
local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")
-- :WaitForChild() waits until Teleport is found
local RemoteEvent = game.ReplicatedStorage:WaitForChild("Teleport")
local PlaceId = 5006415599
local code = TS:ReserveServer(PlaceId)
local function Teleport()
for _, player in pairs(Players:GetChildren()) do
TS:TeleportToPrivateServer(PlaceId,code,player)
end
end
RemoteEvent.OnServerEvent:Connect(Teleport)
You were trying to Teleport the Player Service itself, not the actual Player, so I looped through the PlayerService (Getting the actual players playing the game) and teleporting them.
as I said I dunno about TeleportService, so I might be wrong
2 comments
0
Unable to cast value to a object
0
I edited it, I forgot to change line 11... It should hopefully worknow
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
What are you trying to accomplish?