I’m making a custom name gui using a spritesheet, several ImageLabels
and ImageRectSize
and ImageRectOffset
to make the letters. I currently have a table set with the ImageRectOffset
for each letter/number, and I don’t know how I can take a letter from the users DisplayName
and find it on the table and return the value assigned to it. Also, I would like to know how to filter the characters depending on whether they are a number or not. I googled something that was supposed to do that, but it isn’t working. Any help would be appreciated.
local username = game.Players.LocalPlayer.DisplayName -- User's display name
local charactercount = 0 -- I only have 5 images for the name, so I want to make sure it doesn't error if the display name is greater than 5
local lettertable = { -- The table
Zero = "0,0",
One = "8,0",
Two = "16,0",
Three = "24,0",
Four = "32,0",
Five = "40,0",
Six = "48,0",
Seven = "56,0",
Eight = "64,0",
Nine = "72,0",
A = "0,8",
B = "0,16",
C = "0,24",
-- I'll add the rest once this works
}
for character in username:gmatch(".") do -- Just learned what :gmatch() is
charactercount += 1 -- Add to the count
if typeof(character) == "number" then -- Aparentally this will tell me if it's a number or not? (I rely on google too much)
print(character.." Is a number") -- Doesn't print
elseif character == "_" then
else
table.find(lettertable,character) -- Finding the value in the table from the letter
end
end