How do you print the date/time in ROBLOX Lua? The code I tried was:
debounce = false script.Parent.Touched:connect(function(onTouched) if debounce == true then return end debounce = true msg = Instance.new("Message", game.Workspace) msg.Text = os.date() wait(2) msg:Remove() debounce = false end)
It did not seem to work. Is it even possible to display the date/time in Roblox Lua?
Roblox does not have os.date() so to get the date you could try this
local Months ={'January','February','March','April','May','June','July','August','September','October','November','December'} local daysinmonth = {31,28,31,30,31,30,31,31,30,31,30,31} local ctime = os.time() local year = math.floor(ctime/60/60/24/365.25+1970) local day = math.ceil(ctime/60/60/24%365.25) for k, dim in pairs(daysinmonth) do if day > dim then day = day - dim else month = Months[k] break end end if day < 10 then day = '0' .. tostring(day);end
So for exampleprint(day .. ' ' .. month .. ' ' .. year)
would be 13 August 2014