Hey so im trying to make a system where you can join a server using memorystore, currently the reserve server id gets passed correctly and the menu server and the game server both print the same reserve server id, however when i try to join using that ID it wont let me and says access denied and that the code is invalid which is really weird, ive tried checking if both of them are strings which they are.
Main menu code:
local MemoryStoreService = game:GetService("MemoryStoreService")
local TeleportService = game:GetService("TeleportService")
local FindGame = game:GetService("ReplicatedStorage").FindGame
local Servers = MemoryStoreService:GetSortedMap("servers")
print("version 4")
print(#Servers:GetRangeAsync(Enum.SortDirection.Ascending,100))
FindGame.OnServerEvent:Connect(function(ply)
local players = game:GetService("Players"):GetPlayers()
local SortedMap = Servers:GetRangeAsync(Enum.SortDirection.Ascending, 100)
if #SortedMap >= 1 then
print("1")
local code = Servers:GetRangeAsync(Enum.SortDirection.Ascending,1)
print(code[1]["value"])
print(typeof(code[1]["value"]))
TeleportService:TeleportToPrivateServer(7564937924,code[1]["value"],players)
else
print("2")
local code = TeleportService:ReserveServer(7564937924)
TeleportService:TeleportToPrivateServer(7564937924,code,players)
end
end)
Game code:
local reserveId = game.PrivateServerId
local Players = game:GetService("Players")
local MemoryStoreService = game:GetService("MemoryStoreService")
local servers = MemoryStoreService:GetSortedMap("servers")
local key = #servers:GetRangeAsync(Enum.SortDirection.Ascending, 100) + 1
print(reserveId)
print(typeof(reserveId))
print(#servers:GetRangeAsync(Enum.SortDirection.Ascending, 100))
local function onServerStart()
if #Players:GetPlayers() < 75 then
servers:SetAsync(tostring(key), reserveId, 2592e+6)
end
end
onServerStart()
game:BindToClose(function()
print(servers:GetRangeAsync(Enum.SortDirection.Ascending,100))
servers:RemoveAsync(key)
wait(5)
print("running")
print(servers:GetRangeAsync(Enum.SortDirection.Ascending,100))
end)
There are still a bunch of debug prints that hopefully might help you guys also figure out whats wrong.