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

onChatted scripting Help?

Asked by 10 years ago
function onPlayerChatted(player, message)
    if message == "Computer" or "Anyone here?" then
        local hint = Instance.new("Hint")
        hint.Parent = player
        hint.Text = "Yes?"
        wait(3)
        hint.Parent = nil
    end
end

function onPlayerChatted(player, message)
    if message == "Hello Computer" or "Hello?" or "" then
        local hint = Instance.new("Hint")
        hint.Parent = player
        hint.Text = "Hello Sir."
        wait(3)
        hint.Parent = nil
    end
end

function onPlayerEntered(player)
    wait(1) --delay for loading time
    player.Chatted:connect(function (message) onPlayerChatted(player, message) end)
end

game.Players.ChildAdded:connect(onPlayerEntered)

1 answer

Log in to vote
-1
Answered by 10 years ago

First of all, both functions shouldn't be called the same, causes confusion and may break the script, second of all game.Players.ChildAdded:connect( -- The name of the funciton you wrote, if you're going to make two funcitons then you must repeat Players.ChildAdded:connect( -- The other name.

There thats all I could spot

Also it should be

game.Players.LocalPlayer.Chatted:connect( - the function

0
Still dont work GuardainDev 45 — 10y
Ad

Answer this question