Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Print not working?

Why won't this work?

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

1 comment

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.

1 answer

✓ Accepted answer

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!

1 comment

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.