I honestly dk what I am doing wrong. It works to ban someone but when they join back it doesnt kick them again.
local dds = game:GetService('DataStoreService')
local bandata = dds:GetDataStore('bandata')
game.Players.PlayerAdded:Connect(function(plr)
if plr.UserId == bandata then
local success, banTime = pcall(function()
return bandata:GetAsync(plr.UserId)
end)
if success then
if banTime >= os.time() then
print('Yees')
else
plr:Kick('\n you are banned.')
print('you are banned.')
print('Time Left - ', (banTime - os.time))
end
end
end
end)
game.Players.PlayerAdded:Connect(function(plr)
if plr.Name == 'CRAZYQUACKY84' then
plr.Chatted:Connect(function(ban)
local args = ban:split(' ')
if args[1] == ':ban' then
local plrBan = game.Players:FindFirstChild(args[2])
if plrBan then
bandata:SetAsync(plrBan.UserId, os.time()+180)
plrBan:Kick('\n you have been banned')
end
end
end)
end
end)
