generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Don't understand what's wrong with this..

Previous Thread :: Next Thread 
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
20 Oct 2012 10:13 PM
script.Parent.Text.Changed:connect(function(text)
imagetext = script.Parent.Parent.Parent.ImageLabel
local avatarUrl = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username=" .. text
imagetext.Image = avatarUrl
wait(1)
imagetext.BackgroundTransparency = 0
-- do something with avatarUrl
end)

in local script.

Hierarchy is right I think.
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
20 Oct 2012 10:16 PM
What's text?

http://www.roblox.com/CeaselessSouls-Admin-Commands-Gui-based-item?id=92856199 -- Take one and enjoy! Read the description, has a lot of information.
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
20 Oct 2012 10:17 PM
The function?
Report Abuse
Joalmo is not online. Joalmo
Joined: 28 Jun 2009
Total Posts: 1160
20 Oct 2012 10:19 PM
script.Parent.Text.Changed:connect(function(text) -- in this line, "(text)" isn't the name of the function, but the argument to be passed into the function. Anonymous functions don't get names.
Report Abuse
Woodstauk4 is not online. Woodstauk4
Joined: 27 Dec 2010
Total Posts: 3061
20 Oct 2012 10:20 PM
Text is a property, the .Changed event cannot act on a property, only an object

script.Parent.Changed:connect(function(text)
if text=="Text"then
--code


That should work.
Report Abuse
Joalmo is not online. Joalmo
Joined: 28 Jun 2009
Total Posts: 1160
20 Oct 2012 10:21 PM
Wait, sorry, I misread this. Disregard my post.
Report Abuse
thedeathmaster01 is not online. thedeathmaster01
Joined: 14 Mar 2010
Total Posts: 6331
20 Oct 2012 10:21 PM
script.Parent.Text.Changed:connect(function(text)
imagetext = script.Parent.Parent.Parent.ImageLabel
local avatarUrl = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username=" .. text.Text
imagetext.Image = avatarUrl
wait(1)
imagetext.BackgroundTransparency = 0
-- do something with avatarUrl
end)
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
20 Oct 2012 10:30 PM
Didn't work..
Report Abuse
Woodstauk4 is not online. Woodstauk4
Joined: 27 Dec 2010
Total Posts: 3061
20 Oct 2012 10:34 PM
Mine didn't work? Then get rid of the 'if text=="Text"then' line

That event might not return the type of property changed and the value itself.
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
20 Oct 2012 10:35 PM
@wood Your script won't work because I want this to be free, like any text not just one.
Report Abuse
Woodstauk4 is not online. Woodstauk4
Joined: 27 Dec 2010
Total Posts: 3061
20 Oct 2012 10:37 PM
I don't understand, can you please describe the hierarchy?
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
20 Oct 2012 10:39 PM
_STARTERGUI

--ScreenGui
-ImageLabel
-Frame
(INSIDE FRAME)
TextBox
(SCRIPT INSIDE OF TEXTBOX)
TextLabel
Report Abuse
Woodstauk4 is not online. Woodstauk4
Joined: 27 Dec 2010
Total Posts: 3061
20 Oct 2012 10:40 PM
Where is the script in that?
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
20 Oct 2012 10:40 PM
textbox.
Report Abuse
Woodstauk4 is not online. Woodstauk4
Joined: 27 Dec 2010
Total Posts: 3061
20 Oct 2012 10:41 PM
Oops, ignore that... I'm blind.


So the script should work for the Text property in the TextBox, right?
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
20 Oct 2012 10:44 PM
Yes.
Report Abuse
Woodstauk4 is not online. Woodstauk4
Joined: 27 Dec 2010
Total Posts: 3061
20 Oct 2012 10:45 PM
Then simply using script.Parent.Changed should work correctly, I don't see the problem
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
21 Oct 2012 01:13 PM
bump
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
21 Oct 2012 01:17 PM
script.Parent.Text.Changed:connect(function(text)
imagetext = script.Parent.Parent.Parent.ImageLabel
local avatarUrl = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username=" .. text
imagetext.Image = avatarUrl
wait(1)
imagetext.BackgroundTransparency = 0
-- do something with avatarUrl
end)

GUI = script.Parent;
GUI.Changed:connect(function(property)
if (property == "Text") then
local imagetext = GUI.Parent.Parent.ImageLabel;
local avatarUrl = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username="..GUI.Text;
imagetext.Image = avatarUrl;
wait(1)
imagetext.BackgroundTransparency = 0;
end
end)
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
21 Oct 2012 01:17 PM
Don't mind the top one, forgot to delete your script.
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
21 Oct 2012 04:00 PM
THANK YOU.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image