Hello, Recently I was trying to do script, that will ReserveServer for my game because of lobbies the player can join etc.
Script that recieves event:
local JoinServer = game:GetService("ReplicatedStorage"):WaitForChild("Events"):WaitForChild("JoinServer")
local JoinServer_server = game:GetService("ReplicatedStorage"):WaitForChild("Events"):WaitForChild("JoinServer"):WaitForChild("JoinServer_Server")
local TeleportService = game:GetService("TeleportService")
local PlaceIdServer -- PlaceID Number
local function teleportPlayerToServer(players)
local reservedServerCode = TeleportService:ReserveServer(PlaceIdServer)
TeleportService:TeleportToPrivateServer(PlaceIdServer, reservedServerCode, players)
end
JoinServer_server.Event:Connect(function(lobby_id, players: {})
teleportPlayerToServer(players)
end)
Script that sends event: (other script)
-- its not full script but its only what it does when it sends the event
createEvent.OnServerInvoke = function(player, lobbyData: {})
local temp_id = generateID(lobbyData) -- generateID Function is generating tempID of the lobby, but its useless for now.
JoinServer_Server:Fire(temp_id, {player})
end
Both these scripts are Server Scripts!
When i join the server and tries to connect to that server, it shows me this on screen:
The Place is subplace of the game.
And I dont know how to fix it. Can anyone help me?