Basically I was trying to do a ban script with a reason that people can type when they are doing the ban command, it kicks the player with the reason but it doesn’t save in the data store, or just doesn’t work.
Ban Server:
local success, errormsg = pcall(function()
banDS:SetAsync({plrUserId, context}, true)
end)
Ban Handler:
local banned
local success, errormsg = pcall(function()
banned = banDS:GetAsync(plrUserId)
end)
if banned == true and plr:GetRankInGroup(groupID) <= 249 then
local reason = banned[2]
wait()
plr:Kick("Banned. "..reason)
end
game.Players.PlayerAdded:Connect(function(plr)
local plrUserId = plr.UserId
if manualBan[plrUserId] then
plr:Kick("Banned.")
end
local banned
local success, errormsg = pcall(function()
banned = banDS:GetAsync(plrUserId)
end)
if banned == true and plr:GetRankInGroup(groupID) <= 249 then
local reason = banned[2]
wait()
plr:Kick("Banned. "..reason)
end
end)
I think banned is the table that’s returned that you stored earlier by banning the player. You stored the table in this order: {context, true} so table[1] is the ban reason and table[2] is the banned status (true)
if banned[2] == true and plr:GetRankInGroup(groupID) <= 249 then
local reason = banned[1]
still doesn’t work
30 chsrs ss EDIT: it works, it may have not updated the first time but the second one it worked perfectly, now i have to ask a friend to unban me