I tried. honestly. plz help

local dds = game:GetService('DataStoreService')
local bandata = dds:GetDataStore('bandata')

game.Players.PlayerAdded:Connect(function(plr)
	local data
	pcall(function()
		data = bandata:GetAsync(plr.UserId)
	end)
	local timeNow = os.time()
	if data ~= nil and plr.UserId == data then
		local sinceBan = timeNow - data
		
		if (sinceBan/3600) >= 24 then
			print('ok')
		else
			plr:Kick('\n you are banned.')
		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(game.Players:FindFirstChild(args[2]).UserId, os.time())
					plrBan:Kick('\n you have been banned')
				end
			end
		end)
	end
end)

I just dont know what the problem is. It kicks you but when u join back it wont kick you again. I don't know whether the ban has been stored. I just dk. plz help

4 comments

0

This could be because you've reached a data store limit. Otherwise I'm not too sure.

0

@Dogcraft_01 reaching a data store limit which is 4MB? That's not possible mate, not in this case

0

You should print everything you can and see what it does not print, you are the owner of the code and you can edit it as you want while we can't so you should try every method

0

You should print everything you can and see what it does not print, you are the owner of the code and you can edit it as you want while we can't so you should try every method