ProfileService kicking me when playing with other people

When me and my friend play my game through roblox and we play on one server for some reason the code I have for profileService kicks me after a while, but everything loads so I dont understand why it would do that.
My friend never gets kicked but I always do.

When kicking me the message is “Data Service [ERROR 101]” so something is releasing my profile, but there just isnt anything I have done to release my profile after a while.

profileManagerModule

local function onProfileAdded(plr, profile): ()
	serverModule = require(serverScriptService.serverService.serverModule)
	task.spawn(_manager.updateLeaderstats, plr)
	task.spawn(_manager.loadObjs, plr)
end

local profileStore = profileService.GetProfileStore(
	"test1",
	profileTemplate
)

function _manager:loadPlayerProfile(plr: Player): ()
	local profile = profileStore:LoadProfileAsync("Player_" .. plr.UserId)
	if profile ~= nil then
		profile:AddUserId(plr.UserId)
		profile:Reconcile()
		profile:ListenToRelease(function()
			_manager.profiles[plr] = nil
			plr:Kick("Data Service [ERROR 101]")
		end)
		if plr:IsDescendantOf(playerService) == true then
			_manager.profiles[plr] = profile
			onProfileAdded(plr, profile)
		else
			profile:Release()
		end
	else
		plr:Kick("Data Service [ERROR 102]")
	end
end

function _manager:ReleaseProfile(plr : Player): ()
	if serverModule[plr.UserId] then
		serverModule[plr.UserId] = nil
		local profile = _manager.profiles[plr]
		if profile ~= nil then
			profile:Release()
		end
	end
end

profileMainScript

local playerService = game:GetService("Players")
local serverScriptService = game:GetService("ServerScriptService")

local profileFolder = serverScriptService.ProfileFolder
local _manager = require(profileFolder._ProfileManager)

local function onPlrAdded(plr: Player): ()
	plr.CharacterAdded:Wait()
	_manager:loadPlayerProfile(plr)
end

local function onPlrRemoving(plr: Player): ()
	_manager:ReleaseProfile(plr)
end

for _, player in ipairs(playerService:GetPlayers()) do
	task.spawn(onPlrAdded, player)
end

playerService.PlayerAdded:Connect(onPlrAdded)
playerService.PlayerRemoving:Connect(onPlrRemoving)

PLEASE HELP

1 Like

try to run this script but replace it with your user id

local DataStoreService = game:GetService("DataStoreService")
local Player_DataStore = DataStoreService:GetDataStore("test1")

local YOUR_USER_ID = 1003129349

function Run(userId: number)
	local async = Player_DataStore:GetAsync("Player_"..userId)
	local activeSession = async.MetaData.ActiveSession
	print("active session:", activeSession)
end

Run(YOUR_USER_ID)

if you get an active session, so you’ve pro-ly locked but server didn’t manage to remove the session.

it’s profile service’s bug, if it doesn’t handle correctly then player is locked for 30 minutes as i remember.

if not then well i tried

I can’t immediately see anything wrong here.

Are you aware that pressing play in studio will release your profile?
Does it kick you as soon as he joins?
What if he joins first? Does it still only kick you?
How long before it kicks you?

This solved it, I think. I dont experience the issue anymore. Thanks.

1 Like

this isn’t actually a solution, but possible cause since ProfileService actually locks an access by session ids.

but since ProfileService is too old it handles session “close” in a bit wacky way. it’s just possible for roblox to fail a request to a datastore, so this happened.
nowadays it’s just better to handle sessions with MemoryService what ProfileService doesn’t do since it wasn’t a thing before, so i suspect that

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.