From the client the information is received on the server;

Admin Name, User ID, Length, Reason
When trying to test it, it display this error:

Code snippet:
ReplicatedStorage.Ban.OnServerEvent:Connect(function(admin, UserID, length, reason)
print(admin.Name, UserID, length, reason)
local Banconfig:BanConfigType = {
UserIds = nil,
Duration = length, -- in second
DisplayReason = reason .. " ,This ban was issued by a staff member." ,
PrivateReason = admin.Name,
ExcludeAltAccounts = false,
ApplyToUniverse = true,
}
Players:BanAsync(Banconfig, UserID)
end)
1 Like
UserID is required and must be included inside of the config inside of {}. It is required for BanAsync to run.
1 Like
Alright, same problem though

1 Like
Try this code.
ReplicatedStorage.Ban.OnServerEvent:Connect(function(admin, UserID, length, reason)
print(admin.Name, UserID, length, reason)
local Banconfig:BanConfigType = {
UserIds = {userID},
Duration = length, -- in second
DisplayReason = reason .. " ,This ban was issued by a staff member." ,
PrivateReason = admin.Name,
ExcludeAltAccounts = false,
ApplyToUniverse = true,
}
Players:BanAsync(Banconfig)
end)
3 Likes
i mean yeah tables are reqired (i think) for some stuff to work
1 Like
Seems to work for the USER id however now its the duration

1 Like
hmmm
try printing length and see what it gives you. must be a number
1 Like
Make sure that duration isn’t a string when its sent to the event. Duration must be an integer.
1 Like
works needed to make sure its a number

1 Like
yeah just did that by using tonumber()
3 Likes
exactly
you could use tonumber(length) for that
1 Like
system
(system)
Closed
12
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.