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

How can I Make an event happen onchat? (UnAnswered)

Asked by 10 years ago

I Am making A Four Corners Game...

What I need Is A Script .. Which Has An Onchat Function

When I Say "Game" I would Like A Message to appear at the top saying Game in progress When I Say "End" I Would Like it to say A New Game Will Start Soon

Extra Info : I Want Just Me To Have The Command

2 answers

Log in to vote
1
Answered by 10 years ago

You want to use the Chatted event, then if statements to check if it's you chatting and what the message is.

http://wiki.roblox.com/index.php?title=Chatted_%28Event%29 You want to use it like this:

game.Players.PlayerAdded:connect(function(player)
    player.Chatted:connect(function(message)
        --code
    end)
end)

Just as a note, the parameter "message" is a variable for the message that the player chatted. message == "this is my chat"

--MightyWanderer

0
Sorry I Could See What You Were Trying To Say But I Dont Understand Sorry jblade73 18 — 10y
Ad
Log in to vote
0
Answered by
c0des 207 Moderation Voter
10 years ago
h = Instance.new("Hint", game.Workspace)

names = {"Player1"} --Where you put your name.

game.Players.PlayerAdded:connect(function(player)
    for i, v in pairs(names) do
        if v == player.Name then 
            player.Chatted:connect(function(chatmsg)
                if chatmsg:sub(1,4) == "game" then 
                    if game.Lighting:FindFirstChild(map) then
                    h.Text = "Whatever Your Message Is"
                    wait(5)
                    h:Remove()
        end
    end
end)
0
Thumbs Up! :) c0des 207 — 10y

Answer this question