I just.. wanted to log a player ban on discord. This is line with the error
["content"] = plr .." banned at ".. os.date("*t", os.time()) .. "for using a cheat. Cheat: Not game-source local GUI! Probably using remote spy. Banned for 1 week!"
plr is correct. But I can't manage to get the current time!! I want a ban system to ban for 1 week, but I can't even get the time.. Help me please
EDIT: Fixed. Just put the os.date thing in tostring() and it will work
EDIT2: Nevermind. It doesn't work like that.
EDIT3: Okay so I figured out that I can only use os.time() in a local script. But the thing is, that I don't want users to delete the localscript. Imagine if they deleted the localscript but I can't ban them cuz I don't know the time..
The error says attempt to concatenate a table value as os.date() returns a dictionary.
As seen on the wiki: https://imgur.com/a/fNKZDDE,
os.date
Returns a table containing the components (year, hour, etc.) of a given
time
. The formatString must be either
To correct this, you can get the data you want from the dictionary first and then concatenate the gained data:
local data = os.date("*t", os.time()) -- Get what we need as a string data = data.hour..":"..data.min..":"..data.sec.." on "..data.day.."/"..data.month.."/"..data.year -- So the format is now: hh:mm:ss on dd/mm/yyyy ["content"] = plr .." banned at "..data.."for using a cheat. Cheat: Not game-source local GUI! Probably using remote spy. Banned for 1 week!"