When person joins the server and they have certain value, I need to teleport that player to an empty server, so I use reserved server for that, but it errors with HTTP 403 for me:
Before any questions, yes, I tried making the game public, and I do know about roblox studios limitation that I have to test it in game, like that the script just… doesn’t work I guess, like it doesn’t error, but also doesn’t teleport anybody; here’s the server script:
local TeleportService = game:GetService("TeleportService")
local code = TeleportService:ReserveServer(game.PlaceId)
game.Players.PlayerAdded:Connect(function(player)
if player:WaitForChild("stats"):WaitForChild("KickEvent").Value == 1 and player:WaitForChild("stats"):WaitForChild("KickDidTp").Value == 0 then
player:WaitForChild("stats"):WaitForChild("KickDidTp").Value = 1
print("teleporting")
TeleportService:TeleportAsync(game.PlaceId, code, player)
end
end)
Uh… help
Review the parameters for TeleportService:TeleportAsync(). It takes the placeId, an array of players, and an TeleportOptions instance.
1 Like
is there a way to teleport one specific player?
1 Like
Yes, just have the array only contain the single player.
yeah, it still doesnt work lol
the same issue, it doesnt error in game, but also doesn’t teleport me, made the game public again and tested in roblox’s application too.
The new code is like that now:
local TeleportService = game:GetService("TeleportService")
local code = TeleportService:ReserveServer(game.PlaceId)
local players = {}
game.Players.PlayerAdded:Connect(function(player)
print("that passed")
if player:WaitForChild("stats"):WaitForChild("KickEvent").Value == 1 then
table.insert(players, player)
print("teleporting")
TeleportService:TeleportAsync(game.PlaceId, code, players)
end
end)
It also does print out “that passed” but doesn’t print “teleporing” although this value is in fact == 1
I am honestly confused
You are still passing the wrong kind of parameters for TeleportService:TeleportAsync(). Review the documentation I sent above.
nvm, I found an issue, for some reason the value is 0 (although in the explorer it’s 1)
i added else statement and printing statement for that value, it does execute that else one and prints out 0… I am confused, but that’s another question, so thanks for the help