How do I detect if they are banned or not?

I need help1
I need help! I want to check if they are banned or not. If they are unbanned it will remove their datastore key however if they are still banned it continues with the code. I already know how to set the data, just not getting the temporary data.

We store data in days and -1 is for permanent bans. Help would be appreciated.

local datastore = game:GetService("DataStoreService"):GetDataStore("TravelodgeBans")
local api = require(game.ServerScriptService.TrelloAPI)

game.Players.PlayerAdded:Connect(function(plr)

	local datafolder = Instance.new("Folder", plr)
	datafolder.Name = "BanData"


	local reason = Instance.new("StringValue", datafolder)
	reason.Name = "Reason"
	

	local appeal = Instance.new("StringValue", datafolder)
	appeal.Name = "Appealable"

	local data
	local success, err = pcall(function()
		data = datastore:GetAsync(plr.UserId)
	end)
	

	if success then
		if data then
			if data["Reason"] then
				reason.Value = data["Reason"]
			else
				reason.Value = "No Reason Provided"
			end
		
			if data["Appealable"] then
				appeal.Value = data["Appealable"]
			else
				appeal.Value = "n"
			end
		
			local BoardID = api.BoardsAPI.GetBoardID("Appeal Management")
			local Pending = api.BoardsAPI.GetListID(BoardID,"Pending")
			local Accepted = api.BoardsAPI.GetListID(BoardID,"Accepted")
			local Denied = api.BoardsAPI.GetListID(BoardID,"Denied")
			
			if api.CardsAPI.GetCardOnList(Pending,"["..plr.UserId.. "]") then
				plr.PlayerGui.ScreenGui.InformationFrame.TextButton:Destroy()
				plr.PlayerGui.ScreenGui.InformationFrame.unappealable.Visible = true
				plr.PlayerGui.ScreenGui.ConfirmAppealFrame:Destroy()
				plr.PlayerGui.ScreenGui.AppealFrame:Destroy()
				plr.PlayerGui.ScreenGui.InformationFrame.status.Text = "Under review" 

				datastore:SetAsync(plr.UserId, {
					["Reason"] = data["Reason"],
					["Appealable"] = "n"
				})
				
			elseif api.CardsAPI.GetCardOnList(Denied,"["..plr.UserId.. "]") then
				local CardID = api.CardsAPI.GetCardOnList(Denied,"[" ..plr.UserId.. "]")
				api.CardsAPI.DeleteCard(CardID)
				plr.PlayerGui.ScreenGui.InformationFrame.status.Text = "Declined" 
				datastore:SetAsync(plr.UserId, {
						["Reason"] = data["Reason"],
						["Appealable"] = "y"
					})

				appeal.Value = "y"				
			elseif api.CardsAPI.GetCardOnList(Accepted,"[" ..plr.UserId.. "]") then
				local CardID = api.CardsAPI.GetCardOnList(Accepted,"[" ..plr.UserId.. "]")
				api.CardsAPI.DeleteCard(CardID)
				plr.PlayerGui.ScreenGui.InformationFrame.status.Text = "Accepted" 
				plr.PlayerGui.ScreenGui.InformationFrame.unappealable.Visible = true
				plr.PlayerGui.ScreenGui.InformationFrame.TextButton.Visible = false
				wait(5)
				datastore:RemoveAsync(plr.UserId)
				plr:Kick("Congratulations, your appeal was accepted! To make you aware, if you commit any other offences you may be banned without appeal.")
			end
		else
			plr:Kick("Our system reports that you are not banned, please rejoin. If you continue being brought here, contact us on the comm")
		end
	else
		plr:Kick("Error getting ban data. This could be due to roblox Datastores being down. Please try again later.")
end

end)

Theres no api rn I think to see if they’re banned. But you can save a table of banned players via data store and when they join see if they’re in there and continue

Not what I asked tbh but thanks for your attempt

Do you mean banned on roblox or ingame?
If ingame what part of the code actually bans the user? Also wouldnt it be dumb to delete someones data after their banned? There is like no good reason to do that, cause if they appeal and get unbanned, well woop, their datas gone. Plus again, whats the point of removing their data??

Ingame.

I want to see if their ban time is expired or not.
The point of removing their data is so they are unbanned?

Also this is a ban hub that manages bans

Ohhh ban data, I thought you meant in general data. Let me look through the code and we’ll see