local frame = script.Parent.Parent local inputbox = frame:WaitForChild("TextBox") local holder = frame.Parent local display = holder:WaitForChild("display") local imagelabel = display:WaitForChild("ImageLabel") local userimg = 'http://www.roblox.com/Thumbs/Avatar.ashx?format=png&x=100&y=100&username=' local username = frame:WaitForChild("username") script.Parent.MouseButton1Click:connect(function() username.Value = inputbox.Text wait() imagelabel.Image = userimg..username end)
I'm currently working on a search system that relies on user input. Why can't it link username
to userimg
?
Your problem is that username
is an object, not a string and you tried to concatenate it.
Silly mistakes(:
So to fix? Concatenate the value of username
.
local frame = script.Parent.Parent local inputbox = frame:WaitForChild("TextBox") local holder = frame.Parent local display = holder:WaitForChild("display") local imagelabel = display:WaitForChild("ImageLabel") local userimg = 'http://www.roblox.com/Thumbs/Avatar.ashx?format=png&x=100&y=100&username=' local username = frame:WaitForChild("username") script.Parent.MouseButton1Click:connect(function() username.Value = inputbox.Text wait() imagelabel.Image = userimg..username.Value --Index the value right here end)
As far as I can tell, username
is a value object, and you can't concatenate an object.
You need to get its value or name or some other useful property so that you can properly combine strings.
userimg..username.Value --or userimg..username.Name --or some other property
You also might want to look into the tostring()
method in cases where you need to convert something into a string before concatenating.