i know i fixed the ban ui but i needed just one tiny help.
how would i get a player’s userid globally?
i know :GetUserIdByNameASync() is a thing but i wanna implement it
heres the script where i wanna place it on
local ps = game:GetService("Players")
function convertDaysToSecends(days)
return 86400 * tonumber(days)
end
function convertHoursIntoSecends(hours)
return 3600 * tonumber(hours)
end
local AllowedPeople = {
1813216757,
1915724787,
1029123331,
2728185622,
}
game.ReplicatedStorage["Banny_Binny!"].OnServerEvent:Connect(function(player, bannedplr, banrsn, bandur)
if not table.find(AllowedPeople, player.UserId) then return end
print(tonumber(bandur))
bannedplr = ps:FindFirstChild(bannedplr)
if not bannedplr then warn("no player!") return nil end
local config: BanConfigType = {
UserIds = {bannedplr.UserId}, -- where i wanna place it
Duration = tonumber(bandur),
DisplayReason = banrsn,
PrivateReason = bannedplr.Name.." got banned because of: "..banrsn,
ExcludeAltAccounts = false,
ApplyToUniverse = true
}
local success, errorMessage = pcall(function()
return ps:BanAsync(config)
end)
if success then
for i, v in config do
print(i, v)
end
else
warn(errorMessage)
end
end)
no, just the list of Ids, unless you want to be able to access your functions from any where.
To help give an understanding heres a post on modules that will hopefully help!
no I mean this, when you send bannedplr to the server, it well, its a player from the look of things, thus, instead, you should send bannedplr as a UserId.
they arent banning them via name, robloxs ban async seems to only take UserIds, not to mention in there code you can see they do in fact put the UserId in there, not the name so yeah.
i tried doing everything to make it global but it seems like i couldnt do anything. ill be back once i figure out how to actually get the player’s userid to be global