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

Replacing characters in a string with other characters?

So, I have a string in the format FirstName_LastName. I want to replace the "_" with a space. I've been working on this for a while, nothing seems to work properly. I could send you everything I tried, but I don't see a purpose in that. You guys got any ideas?

1 answer

✓ Accepted answer

You can easily do this with string.gsub. For example, we can do

local name = 'Player_1'
local function tuis(txt) --turn underscore into space
	local s, _ = string.gsub(txt, '_', ' ')
	return s
end
print(tuis(name))

However, people's usernames cannot have underscores in ROBLOX

Hope this helps!

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