MadStudioRoblox / ProfileService

Universal session-locked savable table API
https://madstudioroblox.github.io/ProfileService/
Apache License 2.0
298 stars 158 forks source link

Attempt to call a nil value #20

Closed checkm4te8 closed 2 years ago

checkm4te8 commented 2 years ago

Hi, I get attempt to call a nil value at this line: local profile = ProfileService:LoadProfileAsync(ProfileKey, "ForceLoad") Here is the full code:

local WebhookBlocks = { [131084082] = true }

--Tables local FunctionTable = {}

--Services local RunService = game:GetService("RunService") local ServerScriptService = game:GetService("ServerScriptService")

--Folders local Modules = ServerScriptService.Modules

--Requires local EmbedModule = require(game:GetService("ServerScriptService").Modules.WebhookService) local ProfileService = require(game:GetService("ServerScriptService").Modules.ProfileService)

--Function function FunctionTable.BanPlayer(Player, Reason, ACNote, FalseProb) --Check if this occurence was in Studio --if not game:GetService("RunService"):IsStudio() then if not table.find(require(game.ServerScriptService.Modules["ACImmunity"]),Player.Name) then --Ban the player local ProfileKey = "Player_"..Player.UserId local profile = ProfileService:LoadProfileAsync(ProfileKey, "ForceLoad") profile.Data.IsACPermBanned = ACNote --Kick the Player Player:Kick("You have been permanently banned from Overdrive. You may NOT appeal this ban. You are no longer welcome in Overdrive, farewell.")

    -- Check if userid can send requests
    if WebhookBlocks[Player.UserId] == true then return end

    --Log the ban
    EmbedModule:createEmbed("ANTICHEAT", "AC Ban", "**Username: **"..Player.Name.."\n**UserID: **"..Player.UserId.."\n**Countermeasures taken:** Permanent Ban\n**False Positive probability:** "..FalseProb.."\n**Additional notes:** Ban performed by the AC.\n**Reason:** "..Reason.."\n**Anti Cheat Note:** "..ACNote, "", "0xff0000")

    -- Block Requests from userid
    WebhookBlocks[Player.UserId] = true 
end
--else
print(Player.Name.." not banned because in studio.","Caller:",getfenv(2).script,"Reason:",Reason,"ACNote:",ACNote)
--end

end

--Return the functions return FunctionTable

Sorry that the code is not in a code block, I couldn't get it to work.

LM-loleris commented 2 years ago

I actually already gave an answer to this user error here:

https://devforum.roblox.com/t/save-your-player-data-with-profileservice-datastore-module/667805/819?u=loleris