Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

attempt to concatenate a table value?

Asked by
Miniller 562 Moderation Voter
5 years ago
Edited 5 years ago

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..

0
All you really need is tick(), which is universal for Lall Ankur_007 290 — 5y
0
*all players, irrespective of their timezones Ankur_007 290 — 5y

1 answer

Log in to vote
0
Answered by
Ankur_007 290 Moderation Voter
5 years ago

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!"
Ad

Answer this question