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

How do i make a text when i chat something?

Asked by
Prestory 1395 Moderation Voter
7 years ago

So i know this uses an onchatted function basically when i type in /me (text) i want the thing they type to come up in a writing with there name beside it this is an example

http://prntscr.com/f726aa

So i type that into the chat and this is what happens

http://prntscr.com/f727iv

Im completely clueless on how do it i have tryed multiple times may somebody help me.

0
post code Goulstem 8144 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago

Ok, so it seems like you want it to get what the player says after the /me.

To do this you can do something like:

game.Players.PlayerAdded:Connect(function(Player)
    Player.Chatted:Connect(function(ChatText)
            print(Player.Name, " has chatted")
        if  string.sub(ChatText,1,3):lower() == "/me" then     --Checking if the player says "/me", I am lowering it because they player might do the m uppercase or e uppercase
            local afterText = string.sub(ChatText,  4) --When using string.sub(), first argument is the string and the second is from where it shall begin, third (optional) is deciding if you want to check from 1 to 2
            print(afterText)
        end
    end)
end) 

Ad
Log in to vote
0
Answered by
Prestory 1395 Moderation Voter
7 years ago
game.Players.PlayerAdded:connect(function(player)
    player.Chatted:connect(function(msg)
       if msg == "/me" then
    -- need help here
end
0
I have to break up the msg and get what they say after "/me" and make the text say that Prestory 1395 — 7y

Answer this question