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

string.format does not work with player.Name?

I am so confused right now you like don't understand.

I created this string.format script and it is coming up with an error on line 2;

bad argument #2 to 'format' (string expected, got no value)

The script;

print(player.Name) -- THIS DOES HAVE A VALUE! IT IS NOT NIL!!
output(string.format('%s has done the event thing'), tostring(player.Name))

Any help would be greatly appreciated!!!

EDIT: This works completely fine;

output(player.Name..' has done the event thing')

2 comments

0

Does '%s has done the event thing':format(player.Name) Work?

0

@Omarstein no, that does not work.

1 answer

I don't really know anything about string formatting, but I got it working with the wiki

print(player.Name) -- THIS DOES HAVE A VALUE! IT IS NOT NIL!!
output(('%s has done the event thing'):format(player.Name))

1 comment

0

Came up with the error of 'attempt to index a nil value'

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