I have a script where it displays the users avatar, username and userid when I enter a username into a textbox. And when I enter an account username that doesnt exist, for example if i enter "“entuwfnwu” into the textbox, it will look for the player and try to grab its userid to display it. But that player doenst exist and breaks the code, how would I get around this?
Heres my code:
local player = game.Players.LocalPlayer local frame = script.Parent local username = script.Parent.Parent.Username local userImage = frame.UserImage.UserImage local userNameName = frame.Username local userId = frame.UserId while wait(0.1) do userImage.Image = "http://www.roblox.com/Thumbs/Avatar.ashx? x=150&y=150&Format=Png&username="..username.Text userNameName.Text = username.Text userId.Text = game.Players:GetUserIdFromNameAsync(username.Text) end