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

Print not working?

Asked by 8 years ago

Why won't this work?

function onTouch() print(iKnowYouAreThereCJ) end script.Parent.Touched:connect(onTouch)

2
Please post your code in a "code block" and indent your code, next time. It helps us read and understand your code better. To put it in a code block, click the little Lua logo icon above the text box. Link150 1355 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago

You're not using a string in your print statement.

When printing, you can't use things that are not,

  • Strings

  • Variables

  • Number Values

  • Objects

This means that in order to fix your script, do the following,

function onTouch() 
    print("iKnowYouAreThereCJ") 
end 

script.Parent.Touched:connect(onTouch)

There are other ways of using a string. Some of the most common are using " or '.


You could also use a variable,

function onTouch() 
    local var = "iKnowYouAreThereCJ"
    print(var) 
end 

script.Parent.Touched:connect(onTouch)

Hope this helped!

Good Luck!

2
Looking through your questions, you haven't yet accepted any answers. It will help you gain rep, and help me/us in the process. If I did help, please accept. You also asked a question similar to this, meaning you need to learn how to print strings. Good luck! User#11440 120 — 8y
Ad

Answer this question