So I have this code, and the PlayerRemoving will run just fine, but the PlayerAdded does not run. I do not know why, so any feedback is helpful.
local function CheckForBan(player)
if SavedBans[tostring(player.UserId)] then -- and player.UserId ~= 106251901 then
local timeSinceBanned = os.time() - SavedBans[tostring(player.UserId)].bannedTime
local banLength = SavedBans[tostring(player.UserId)].banLength
if banLength == "Perm" then
player:Kick("You have been PERMANENTLY banned from this game. Contact a dev for a possible repeal")
end
if (timeSinceBanned / 86400) >= banLength then
print("Ban is over for "..player.Name)
else
player:Kick("You are still banned for "..tostring(banLength - (timeSinceBanned / 86400)).." days")
end
end
end
game:GetService("Players").PlayerAdded:Connect(CheckForBan)
game:GetService("Players").PlayerRemoving:Connect(CheckForBan)