Profile Service kicks me

I’m watching a tutorial on ProfileService

When I go to test it I immediately get kicked and idk why

Code:

local Players = game:GetService("Players")
local PlayerData = require(script.Parent.PlayerData)
local ProfileService = require(script.Parent.ProfileService)
local PlayerManager = require(script.Parent.PlayerManager)

-- 🚨🚨ALWAYS SET IT TO "PublishedData" WHEN PUBLISHING UPDATE🚨🚨
local ProfileStore =  ProfileService.GetProfileStore("PublishedData", PlayerData)

local function Giveleaderstats(Player: Player)
	local Profile = PlayerManager.Profiles[Player]
	if not Profile then return end
	
	local leaderstats = Instance.new("Folder", Player)
	leaderstats.Name = "leaderstats"
	
	local boodies = Instance.new("NumberValue", leaderstats)
	boodies.Name = "Bodies"
	boodies.Value = PlayerData.bodies
	
	local FOV = Instance.new("IntValue", Player)
	FOV.Name = "FOV"
	FOV.Value = PlayerData.FOV

end


local function Playeradded(Player: Player)
	local Profile = ProfileStore:LoadProfileAsync("Player_" .. Player.UserId)
	if Profile == nil then
		Player:Kick("urrrm you data is a little buggy, try again later")
		return
	end
	
	Profile:AddUserId(Player.UserId)
	Profile:Reconcile()
	Profile:ListenToRelease(function()
		PlayerManager.Profiles[Player] = nil
		Player:Kick("urrrm you data is a little buggy, try again later")
	end)
	if Players:IsDescendantOf(Players) == true then
		PlayerManager.Profiles[Player] = Profile
		Giveleaderstats(Player)
	else
		Profile:Release()
	end
end
for _, player in Players:GetPlayers() do
	task.spawn(Playeradded, player)
end

Players.PlayerAdded:Connect(Playeradded)

Players.PlayerRemoving:Connect(function(Player: Player)
	local Profile = PlayerManager.Profiles[Player]
	if not Profile then return end
	Profile:Release()
end)

Is Studio API access on?‎‮‎‮‎‮‎‮‎‮‎‮‎‮‎‮‎‮‎‮‎‮‎‮‎‮‎‮‎‮‎‮‮‮‎‎‮
Chars

1 Like

Yes Studio Apis is on but I re checked the whole video and the code is right

1 Like

if 2 same player in same game it is kicking maybe this is your bug

1 Like

Have you tried reinstalling ProfileService?

1 Like

I just reinstalled ProfileService and that didn’t work

1 Like

Something must be kicking you. It’s likely failing to load data, or the trigger for that is being false fired. Also, have you tried removing ProfileService?

1 Like

I removed ProfileService and it didn’t kick me and when I added it back it kicked me when I joined

1 Like

You used the wrong variables here. Its Players both times when it should be like this:
if Player:IsDescendantOf(Players) == true then

What your current code is doing is just checking if the Players service is parented to the Players service, which it is not, causing the profile to get released, which causes you to get kicked.

3 Likes

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