it’s because it’s shown to the player via a GUI that allows them to generate a code and insert one to join a private server. However I understand it being frustrating for some players to have to insert a code larger than 5 characters because automatically stuff like that gets moderated in chat messages.
So is it just server wise? because you could program a system where the player selects people to send the code to, kinda like an invite system. Also, is the code really long every time or is it sometimes short or sometimes long?
You can make your own code generator and assign the access code to it in a datastore:
local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")
local DSS = game:GetService("DataStoreService")
local DS = DSS:GetGlobalDataStore()
local function CreateAccessCode()
local CodeGenerator = require(7594040505) -- Code Generator
local CodeLength = 9 -- Optional
local AccessCodeKey = CodeGenerator:p1(CodeLength,0)
local AccessCode = TS:ReserveServer(game.PlaceId)
if pcall(function()
DS:SetAsync(AccessCodeKey,AccessCode)
end) then
return AccessCodeKey
else
return nil
end
end
-- This is an extra function, you can edit or remove it.
local function JoinReservedServer(Player, ServerAccessCode)
local AccessCode
local success = pcall(function()
AccessCode = DS:GetAsync(ServerAccessCode)
end)
if success then
pcall(function()
TS:TeleportToPrivateServer(game.PlaceId,AccessCode,{Player})
end)
end
end
local function JoinReservedServer(Player, ServerAccessCode)
local AccessCode
local success = pcall(function()
AccessCode = DS:GetAsync(ServerAccessCode)
end)
if success then
pcall(function()
TS:TeleportToPrivateServer(game.PlaceId,AccessCode,{Player})
end)
end
end
This is you:
“The function name doesn’t need to be JoinReservedServer, new name: J”
nc (new code isn't needed)
l TS = g:GS("TS")
l P = g:GS("P")
l DSS = g:GS("DSS")
l DS = DSS:GGDS()
l f CAC()
l CG = r(7) - C G
l CL = 9 - O
l ACK = CG:p(CL,0)
l AC = TS:RS(g.PI)
i p(f()
DS:SA(ACK,AC)
e) t
r ACK
e
r n
e
e
- T i a e f, y c e o r i.
l f JRS(P, SAC)
l AC
l s = p(f()
AC = DS:GA(SAC)
e)
i s t
p(f()
TS:TTPS(g.PI,AC,{P})
e)
e
e
I made it print the error messages in my testing script, and I wasn’t sure if this topic owner wanted to print stuff or not, so I removed it, and didn’t think about removing the variables.