I'm moving my minigame place's message system into the ROBLOX Lua Chat to make it more streamlined with ROBLOX UI since I think it looks better than the UI I make (self own?)
Anyway, I've got basically functionality down and created a custom chat channel so I can easily add system messages and allow for me to do more complex stuff with the chat. The main complex thing I want to do is a message that's a timer.
For example, when my game is in intermission, there's a timer. It's currently on a GUI I made but since I've moved most of the other stuff to the chat gui it creates a large contrast when it's the only GUI element in my game that isn't part of the coreUI. It has text formatted via:
string.format("%.2d:%.2d", Time/60%60, Time%60)
and a bar behind the text that decreases with the time:
local percentage = (Time / start) --Start being the seconds it starts at and Time being the current time left.
bar.Size=UDim2.new(percentage,0,1,0)
I'm not really sure how I would move it to the ROBLOX chat. I've looked at this article on the developer wiki https://developer.roblox.com/articles/Lua-Chat-System, specifically the Message Creator Module section but it didn't really help. I added to the chat constants module MessageTypeTimer and also created a Message Creator module (it's just the example given, but with the chat constant changed from MessageTypeTime to MessageTypeTimer).
What I want to do is, via my custom chat channel, to be able to send a MessageTypeTimer message but as I've said, I have no clue how to even start.
Here's how I send a systemmessage in the first place:
hintMessage.OnServerEvent:Connect(function(player,msg,sender,messageType)
print(player,msg,sender)
if(not sender or not verifiedSenders[sender.Name]) then
return
end
if(messageType) then
--for timer message when I know how to do it ;_;
else
mainChannel:SendSystemMessageToSpeaker(msg,player.Name,{ChatColor=Color3.fromRGB(255,255,0)})
end
end)
I'd also like to be able to update the timer without having to do something "hacky" like removing it and then sending it again every second unless that's the only way.
