How do you print?

Hey everyone,

I was wondering what you do when it comes to printing out stuff. Let’s say your printing a welcome message when a player joins your server. What would you print? Would you print out something boring like player joined the server or something more pretty like [Server]: {Player.DisplayName} has joined the server! ? Do you have the same printing style when it comes to printing on the server and client?

And what do you think is the best way and most effecient way for printing out stuff?
I’m looking forward for your replies!

5 Likes

This is more of a UI/UX style question than a programming/dev one; you might fare better in another subforum. My advice would be to just see what games you play do, and what you think looks best and go with that. It’s not really Roblox-specific, consider any games you play. How you work things like player joins will not make or break your game either way.

5 Likes

I am such a gigachad; I do not engage in this printing stuff because it’s beta behavior because I am an alpha. :wolf: :sunglasses:

But for real, I would rather make it look good and readable instead of printing “Player joined.” or something like that.

4 Likes

the only instances when i use print is when it comes to debugging, and i usually just do index printing or value printing to see what code runs and what doesn’t.

here’s an example:

local bool = false
print("1")
if bool then
   print("2")
end
workspace.Baseplate.Anchored = false
print("3")

in this case, the output would only print 1 and 3, which means the if statement did not ever get run.

6 Likes

damn i thought it was just me that debugged like this :sob:

3 Likes

do you mean making chatmessages using the ChatService surch as “[Server]: Don’t forget to like and favorite the game!” or something?

2 Likes

I thought you actually meant how do you print.

3 Likes

Depends on the programming langauge, in lua for example it would be this:

print("Hello world!")

While in something like C, it would be this.

#include <stdio.h>

int main()
{
    printf("Hello World");
    return 0;
}

Just kidding! I would do my chat messages like this
'Game Announcement: {Player.DisplayName} has joined the game.'

5 Likes

i’d do something like this

local Bool = false
print("Checking Bool")

if Bool then print("Bool is true") end

workspace.Baseplate.Anchored = Bool
print("Set Baseplate.Anchored to", Bool)
3 Likes

Yeah no I’m sorry I didn’t know what to name it haha

3 Likes

Most of my prints while debugging basically make a sentence.

So while I was debugging today I will show you the output:

And really the more prints I need to add to pinpoint an exact bug becomes me just being like:

print(`we found data`)
print(data)

save(data)
print(`we saved that data above`)

else

print(`we failed to save that data above`)
3 Likes

i’m surprised at how many people use backticks when printing

i thought i saw a post saying “using backticks (print(`Message`)) to print is the slowest way to print”

2 Likes

Why are people using these symbols instead of ’ or even " in first place

2 Likes

i love backticks, i can just

local data = `hello`
print(`{data` HELLO!} -- > hello HELLO!

and then a message

3 Likes
-- Backticks:
print(`Welcome to my game, {Player.Name}!`)

...

-- Quotes:
print("Welcome to my game,", Player.Name .."!") -- Single

print('Welcome to my game,', Player.Name ..'!') -- Double
3 Likes

I also use print for debugging mostly. Sometimes I’ve left prints inside of published systems that run on the server just in case some obscure bug happens and I can catch what it’s doing at the time in the console.

If I leave a print in intentionally it’s always formatted so that it’s easy to follow and as to the point as possible.

3 Likes