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

Print() function isn't working?

Asked by 8 years ago

Okay to sum up my problem I'm making a fully operational AI on roblox to help out on studio when you have questions and stuff but for some reason it's not working

bosswalrus

game.Players.PlayerAdded:connect(function(player)
    player.Chatted:connect(function(msg, player)
    if msg:lower():sub(1,10) == "bosswalrus" then
        returnmsg = ''
        am = msg:sub(12):lower()
        if am == "hello" then 
            print["Hello]"
        end
    end)
end)

2 answers

Log in to vote
2
Answered by 8 years ago

print["Hello]" should probably be print"[Hello]"

0
Thanks it worked, I don't know what was wrong but it worekd perfectly User#5978 25 — 8y
1
With a square bracket, the script is expecting something else, not a string which will be printed. alphawolvess 1784 — 8y
Ad
Log in to vote
1
Answered by 8 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.
game.Players.PlayerAdded:connect(function(player)
    player.Chatted:connect(function(msg, player)
    if msg:lower():sub(1,10) == "bosswalrus" then
        returnmsg = ''
        am = msg:sub(12):lower()
        if am == "hello" then 
            print("Hello")
        end
    end)
end)

Answer this question