I am trying to make a “message” admin command so an admin could type out :m hello and hello would appear on the screen.
But I want the message to delete after a certain time depending on the length of it instead of having a pre-set fade out time which would need to vary depending on the length.
I have tried searching on the dev forum but I can’t find anything relevant to this.
Is there a particular way I can get message read time or something similar to that.
It just depends how you want to set it up, but I would suggest adding the ability to do like “:m 10 your message here” where the 10 would mean 10 seconds.
You can get the 10 by doing
string.find(msg, "%d+"), which just finds the first number in the string.
I’ll leave the rest of the implementation up to you.
Yes I was considering of doing that, but I have seen in other admin scripts where the message fades out based off how long it is. Thanks for your help anyway though.
Oh well if that’s the case, you can get a value for the length of the message by using
string.len(msg) which will return the number of characters in the message. From there the proportion of length to time is up to you.
Ah, good idea. Probably should of thought of that, thanks a lot for your help!
No problem. I misread your original question looking back on it, so that’s my bad.
No don’t worry, that was my original idea anyway to just have the player input a fade out time.