How to make a ban datastore service have a timer to be un banned?
I have made a script to un ban the player after it meets the ban date and it dont seem to work. can i get help? the code i have is
05 | local DS = game:GetService( "DataStoreService" ) |
06 | local BanDataStore = DS:GetDataStore( "BanDataStoreStudioTest" ) |
10 | local RStorage = game.ReplicatedStorage |
11 | local BanFunction = RStorage.BanPlayer |
12 | local UnBanFunction = RStorage.UnBanPlayer |
13 | local AdminIds = { 261477936 , 1 , 156 , - 1 } |
14 | local Storage = game.ServerStorage |
15 | local BanFolder = Storage.BanFolder |
19 | game.Players.PlayerAdded:Connect( function (Player) |
24 | local PlayerBanFolder = BanFolder [ Player.UserId ] |
25 | local BanDate = BanDataStore:GetAsync(Player.UserId) |
26 | local DayLength = PlayerBanFolder.DayLength |
27 | local Reason = PlayerBanFolder.Reason |
29 | local Seconds = os.time()- tonumber (BanDate.BanLength) |
30 | local Minutes = Seconds/ 60 |
31 | local Hours = Minutes/ 60 |
33 | if Days < = DayLength.Value then |
34 | Player:Kick(Reason.Value.. " Please Appeal In Our Discord Server In Channel 'assassination-secrecy-appeal' For A Chance To Be Un-Banned Early Or Reduce!" ) |
35 | elseif Days > = DayLength.Value then |
36 | PlayerBanFolder.Reason.Value = "" |
37 | PlayerBanFolder.DayLength.Value = 0 |