Attempt to compare string <= number

  1. What do you want to achieve? Keep it simple and clear!
    Get rid of errors.
  2. What is the issue? Include screenshots / videos if possible!
    attempt to compare string <= number - line 7
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    nothing.

NOTE: My DataStore table are number but why it’s issue?

local BanData = game:GetService("DataStoreService"):GetDataStore("Bans")

game.Players.PlayerAdded:Connect(function(player)
	if BanData:GetAsync(player.UserId) then
		local Length = BanData:GetAsync(player.UserId).Length
		local Date = os.date("*t")
		if Length >= Date.year..Date.month..Date.day..Date.hour then -- problem here
			BanData:RemoveAsync(player.UserId)
		end
		player:Kick("YOU HAVE BEEN BANNED: REASON: ["..BanData:GetAsync(player.UserId).Reason.."] LENGTH TIME: ["..Length.."]")
	end
end)

You have to transform it to a number since os.date gives a String

if Length >= tonumber(Date.year..Date.month..Date.day..Date.hour) then
5 Likes