menu
Roblox Forum Archive
Home
User Search
Forums
Donate
search
settings
Home
User Search
Forums
Donate
launch
Go to User Dashboard
Forums
Scripting Helpers
About string.sub(), trying to fetch a username.
chevron_left
chevron_left
chevron_left
of
1
chevron_right
chevron_right
chevron_right
About string.sub(), trying to fetch a username.
GrimstoneRPG
Join Date: 2010-04-29
Post Count: 34
#32524361
Thursday, August 26, 2010 3:02 AM GMT
Hi, I am trying to create an ImageLabel that checks the player's name, and gets his avatar thumbnail. This is what I have: script.Parent.Ava.Image = "
http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username="..p.Name
if sub.string(1, 5, p.Name) == "Guest" then script.Parent.Ava.Image = "
http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username=ROBLOX
" end This is the output I am getting: Players.GrimstoneRPG.PlayerGui.rpgGUI.Script:13: bad argument #3 to 'sub' (number expected, got string) Any help would be appreciated.
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
motorstephen
Join Date: 2007-10-12
Post Count: 10822
#32524414
Thursday, August 26, 2010 3:03 AM GMT
if string.sub(p.Name,1,5) == "Guest" then
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
TheNewArchitect
Join Date: 2010-08-19
Post Count: 35
#32524416
Thursday, August 26, 2010 3:03 AM GMT
string.sub(p.Name,1,5)
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
GrimstoneRPG
Join Date: 2010-04-29
Post Count: 34
#32524499
Thursday, August 26, 2010 3:05 AM GMT
Thank you, it worked.
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
crazypotato4
Join Date: 2010-02-22
Post Count: 20000
#32524819
Thursday, August 26, 2010 3:11 AM GMT
i would actually do string.sub(p.Name,1,6) == "Guest " to avoid not showing people who have fake guest usernames, for example, if someone's name is Guest1337 because they're pretending to be guest.
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
chevron_left
chevron_left
chevron_left
of
1
chevron_right
chevron_right
chevron_right