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

Status/Event bar help?

Asked by 8 years ago

So is there a way for roblox to detect a message in the chat starting with a certain symbol, then get the rest of the message? It would be really very useful for a model i have created https://www.roblox.com/Status-Bar-item?id=407082364 For example i could type "evn:1v1" and a gui test would change to "1v1" or i could say "evn:test" and it would be changed to "test". Especially because I'm useing this in a War Group training place so we could host training events. Hope you understand (my first question asked here :),

iFireLazer

1 answer

Log in to vote
0
Answered by 8 years ago

here is a simple one using the chat event.

prefix = ':' -- symbol here
game.Players.PlayerAdded:connect(function(plr)
plr.Chatted:connect(function(msg)
local num = msg:match('^.-' .. prefix .. 'm')
print(num)
if  num then
local m = Instance.new('Message', workspace)
m.Text = msg:sub(num:len()+1,msg:len())
wait((msg:len()-num:len())/10)
m:Destroy()
end
end)
end)
0
ok but i just have one more quiestion; what does all that stuff on lines 8, 9, and 10 mean? My guess is that is has something to do with the remoal of ":m" but i think i need that explained to me please iFireLazer 35 — 8y
0
well you see in matching or string patterns '^' means at the beggining of the string '.' means all the characters, '-' means to get 0 or more. then I added the prefix and m to get '^.-:m' with '^.-' being the pattern and ':m' being what we look for. so if someone said 'ebybse:m hello' it would still work in the same way as ':m hello'. now the reason why I did this is to get the string lenght fro Angels_Develop 52 — 8y
0
now the reason why I did this is to get the string lenght from fhes:m or :m so I can then depict the message. in contrare there are to ways to set up string maniulation string.len('string') or ('string'):len(). so I got the lenght of that and added one because there will always be a space for peopple in there answers. and then I got it so it gets to the end of the message. line 10 is just so we ca Angels_Develop 52 — 8y
0
then it destroys the message because we dont want it up there. Angels_Develop 52 — 8y
0
oh ok. But i just wanted to say, Messages are deprecated now, i had to change that to appear in a GUI. But thanks for the help! iFireLazer 35 — 8y
Ad

Answer this question