Hello everyone! I’m now developing a game where each round takes a place in other place (like in dead rails), now I’m trying to make a rejoin system when I leave the game when it’s not over.
I’m facing a problem now, describing it below:
When a player is teleported, the game saves in the DataStore the code of the private server that was reserved for the players, as well as the PlaceId where they should be teleported. If a player leaves the game, but the round is not over yet, he can return to the game (the rejoin menu appears), but when you click the rejoin button, the player is not teleported, and an error is displayed:
Here is a part of the script with a reaction to a button click:
Rejoin.OnServerEvent:Connect(function(player, PlaceId, ServerId)
game:GetService("TeleportService"):TeleportToPrivateServer(PlaceId, ServerId, player)
print("== TELEPORT REJOIN FIRED")
end)
At first I thought that this problem was related to the fact that IDs are not saved, and I added a print from IDs, and everything was here.
I decided to add a print when entering the round itself, but for some reason an error appears:
(I’ll add the code responsible for this print a little later)
And I decided to add a print again - this time to the part where the player is teleported:
Here is the code for teleporting and saving ID:
Plr:WaitForChild("ServerData").ServerId.Value = TeleportOptions.ReservedServerAccessCode
local code = TeleportOptions.ReservedServerAccessCode
print("code " .. Plr:WaitForChild("ServerData").ServerId.Value)
game.ReplicatedStorage.RejoinEvents.SaveCode:FireClient(Plr, code)
Here is the code for the teleport button
script.Parent.MouseButton1Click:Connect(function()
local Place = PlaceId.Value
local Server = ServerId.Value
print("== REJOIN FIRED")
game.ReplicatedStorage.RejoinEvents.Rejoin:FireServer(PlaceId, ServerId)
print("sent")
script.Parent.Parent.Visible = false
end)
Thanks in advance for your answers ![]()





