I tried tonumber() an already number. Didn't work
Server Script
repeat wait() until game.Workspace local TeleportService = game:GetService("TeleportService") local Remote = script.Parent.Event Remote.OnServerEvent:Connect(function(SentFrom, Setting, ExtraData) if string.lower(Setting) == "teleport" then local finished, err = pcall(function() local Code = TeleportService:ReserveServer(ExtraData) TeleportService:TeleportToPrivateServer(4805466213, Code, {SentFrom}) end) if not finished then warn(err) end end end)
Local Script
function GenCode(Len, Al, Num, Special, Space) local Len_Code = Len local Alphabet = Al local Numbers = Num local SpecialCharacters = Special local Space = Space local alphabet = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz' local numbers = '1234567890' local specialcharacters = '{}!@#$%^&*()_+-=[]\\/.,*+' local space = ' ' local output = '' local function ReturnUsable() local returntable = {} if Alphabet == true then table.insert(returntable,1,alphabet) end if Numbers == true then table.insert(returntable,1,numbers) end if SpecialCharacters == true then table.insert(returntable,1,specialcharacters) end if Space == true then table.insert(returntable,1,space) end return returntable end for i = 1, Len_Code do local tables = ReturnUsable() local CurrentType = tables[math.random(1,#tables)] local a = math.random(1,string.len(CurrentType)) output = output..string.sub(CurrentType,a,a) end return output end function CreateCode() return GenCode(6, true, true, false, false) end function CreateGame() local Code = CreateCode() Remote:FireServer("Teleport", Code) end CreateBtn.MouseButton1Click:Connect(CreateGame)
The function TeleportService:ReserveServer
takes 1 argument. That argument is the place id of the place you want to reserve a server at.. the function returns a code, this code is passed to TeleportService:TeleportToPrivateServer
as the second argument.. The argument list of TeleportService:TeleportToPrivateServer
is:
1: onces again the place Id where you reserved server
2:server code returned from ReserveServer
3: players to teleport
however, you passed a custom made(ExtraData) id to ReserveServer
, which i assume is a string..