How to save a reserved server access code and private server id?

I’m making a game where there is a build mode place and I am wondering how you would save a reserved server access code and the private server id to a DataStore so people can join they’re friends build mode servers. Any suggestions? Thanks!

You can save the access code to a key of the players user id.

local accesscode = whateveraccesscode
Datastore:SetAsync(Player.UserId, accesscode)
-- Once you need the code to teleport the friend to the server you can just do
local friendsuserid = game:GetService("Players"):GetUserIdFromNameAsync(FRIENDS NAME HERE)
local GetAccessCode = Datastore:GetAsync(friendsuserid)
if GetAccessCode then
     --teleport player to that server
end
2 Likes