I honestly have no idea what is wrong with script. Can you send the current version of the server script in case I missed something?
BanEvent.OnServerEvent:Connect(function(Player, username)
print(Player.Name)
print(Player.UserId)
print(username)
local target = GetUserId(username)
if target == nil then
warn("UserId not found!")
return
end
if PanelWhitelist[Player.UserId] then
print("SUCCESS")
for i, player in pairs (Players:GetPlayers()) do
if player.UserId == target then
local success, errorm = pcall(function()
BanStore:SetAsync(player.UserId, true)
end)
if success then
player:Kick("???")
else
warn("Error with saving ban data, error message: "..errorm)
end
end
end
elseif not PanelWhitelist[Player.UserId] then
print("SUCCEEDED")
Player:Kick("NICE EXPLOITS.")
end
end)
The script seems ok to me. All I can really say is make sure that the username is correct and test it in game. Sorry for not being able to fix the issue.
It’s still printing “UserId not found” even when I test it in the actual game. I’m not sure why.