local serverscriptservice = game:GetService("ServerScriptService")
local manager = require(serverscriptservice.playerdata.manager)
local Template = require(serverscriptservice.playerdata.Template)
local profileservice = require(serverscriptservice.libs.ProfileService)
local KICK_DATA = "je kanker data doet het niet msg mij op discord"
local function CreateLeaderstats(player: Player)
local profile = manager.Profiles[player]
if not profile then
return
end
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
local clicks = Instance.new("NumberValue", leaderstats)
clicks.Name = "Clicks"
clicks.Value = profile.Data.clicks
local gems = Instance.new("NumberValue", leaderstats)
gems.Name = "gems"
gems.Value = profile.Data.gems
end
local profileStore = profileservice.GetProfileStore("test", Template)
local function LoadProfile(player: Player)
local profile = ProfileStore:LoadProfileAsync("Player_" .. player.UserId)
if not profile then
player:Kick(KICK_DATA)
return
end
profile:AddUserId(player.UserId)
profile:Reconcile()
profile:ListenToRelease(function()
manager.Profiles[player] = nil
player:Kick(KICK_DATA)
end)
if player:IsDescendantOf(players) == true then
manager.Profiles[player] = profile
CreateLeaderstats(player)
else
profile:Release()
end
end
for _, player in players:GetPlayers() do
task.spawn(LoadProfile, player)
end
players.PlayerAdded:Connect(LoadProfile)
players.PlayerRemoving:Connect(function(player)
local profile = manager.Profiles[player]
if profile then
profile:Release()
end
end)``` whats the problem i dont understand can anyone help?
#need help with simple script
1 messages · Page 1 of 1 (latest)
the error means you tried to do nil.Instance on line 59
sorry im new to script can you explain how i fix it
it means you did local thing={} thing=nil thing[player]=something
fixing it involves .. y'know, not indexing a nil value
manager.Profiles[player] = nil so removing the nil here?
is that line 59?
i fixed it
** You are now Level 3! **
i forgot a capital P