I have this code for my game, it wont' work though because I am using invalid access code, what can I do to get a valid access code.

local DSS = game:GetService("DataStoreService")
local DS = DSS:GetGlobalDataStore()
local code = DS:GetAsync("ReservedServer")
local TpS = game:GetService('TeleportService')


game.ReplicatedStorage.Teleport.OnServerEvent:Connect(function(plr, Place, saves)
	code = TpS:ReserveServer(game.PlaceId)
	DS:SetAsync("ReservedServer",code)
	TpS:TeleportToPrivateServer(Place, code, {plr}, '', saves)
end)

2 comments

0

What is passed into the Place parameter? If you're trying to teleport someone to 'Place', but you are reserving a server for the current place (line 8), 'code' will be an access code for another place, therefor making it invalid. Could this be your problem?

0

Thankyou, I changed game.PlaceId to Place