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: touch function on gui

Previous Thread :: Next Thread 
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
06 Feb 2014 07:29 PM
I try this


script.Parent.Touched:connect(function(hit)
if hit.Name == "ImageLabel2" then
print("starting")
Instance.new("Message",Game.Workspace).Text = "uh oh, we have a car crash"
end
end)


It doesen't print starting!
and once my 2 images touch, it doesen't print starting or make teh message.
Help please.

Report Abuse
YumERAGON is not online. YumERAGON
Joined: 18 Apr 2012
Total Posts: 3893
06 Feb 2014 07:31 PM
Because hit.name isn't imagelabel2
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
06 Feb 2014 07:31 PM
I posted before but some people gave me a really confusing wiki page that i don;t understand at all.
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
06 Feb 2014 07:33 PM
Yum, I've seen you on posts. U do not know any lua.
You thought a clickdetector was


script.Parent.ClickDetector.MouseButton1


lol, so, learn lua before u can help people


And, Yes!!! THE HIT'S NAME IS IMAGELABEL2!
Report Abuse
YumERAGON is not online. YumERAGON
Joined: 18 Apr 2012
Total Posts: 3893
06 Feb 2014 07:34 PM
Ok have fun
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
06 Feb 2014 07:34 PM
ok, thanks :)
Report Abuse
heroesp is not online. heroesp
Joined: 23 Feb 2011
Total Posts: 3214
06 Feb 2014 07:38 PM
If you want a car crash to happen when they click the GUI then make a TextButton remove the Text add a imagelabel inside of it and then do a MouseButton1Down event.

Example

script.Parent.MouseButton1Down:connect(function()
print("Has been clicked")
end)

-- What this does is whenever the scripts parent is clicked it will print "Has been clicked"
Report Abuse
heroesp is not online. heroesp
Joined: 23 Feb 2011
Total Posts: 3214
06 Feb 2014 07:40 PM
+ The argument for Touched is whatever touched it... You want a imagelabel touch it?
Report Abuse
Fearlessblocky202 is not online. Fearlessblocky202
Joined: 16 Jun 2010
Total Posts: 391
06 Feb 2014 07:48 PM
How about:


script.Parent.Touched:connect(function(ImageLabel2)
print("starting")
Instance.new("Message", game.Workspace).Text = "uh oh, we have a car crash"
end)



I am not sure, but it looks right to me
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
06 Feb 2014 07:53 PM
That wont change anything

an argument can be called anyting.


And, I wnt it to check when they crash (They Tween to the same position in a diff script
Report Abuse
XtremeTemper is not online. XtremeTemper
Joined: 02 Mar 2012
Total Posts: 1774
06 Feb 2014 07:55 PM
Touched doesnt work on GUI's...You have to make it check the position of both of the GUI's and if they are at a certain position, make it run something.
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
06 Feb 2014 07:56 PM
C'mon, it can be used for MANY things.
like..... a gui where someone walks and if a mountain is there, then stop the walk function


how would I do it


I think touched only applys to parts, not imagelabels, so, how would I?
If it's a bunch of math, then can someone post teh math?

Report Abuse
heroesp is not online. heroesp
Joined: 23 Feb 2011
Total Posts: 3214
06 Feb 2014 07:58 PM
What do you want to happen exactly?
Report Abuse
DragonODeath is not online. DragonODeath
Joined: 02 May 2011
Total Posts: 1252
06 Feb 2014 07:58 PM
Hello idiot. Touched only works on parts. That's it. If you want someone to be able to appear like they're "touching" a 3D gui. Use BillboardGui.
If you want the someone to have a 2D gui on their screen, use a button.
Here's a quick way to learn, go to the wiki. Press Alt+X. If it doesn't work, do it again. Worked for me.
Report Abuse
XtremeTemper is not online. XtremeTemper
Joined: 02 Mar 2012
Total Posts: 1774
06 Feb 2014 07:59 PM
t1 = first GUI (i.e. script.Parent.TexLabel)
t2 = 2nd GUI (i.e. script.Parent.TexLabel)

function check()
if t.Position == t2.Position then
print("The 2 GUI's are perfectly aligned!")
end

t1.Changed:connect(check)
t2.Changed:connect(check)


--Something like this.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Feb 2014 08:03 PM
-.- it's called math
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
06 Feb 2014 08:08 PM
DragonODeath, shut ur face
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Feb 2014 08:10 PM
As hostile as he was, there is no actual touched event for GUI objects (textlabel, textbox, etc.)
You have to use fairly basic math
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
06 Feb 2014 08:11 PM
I already posted that I thought that.
Btw, what type of math
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
06 Feb 2014 08:11 PM
addition subtraction and greater than or less than
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Feb 2014 08:12 PM
Addition, Subtraction, Comparing (greater than/less than)
Here, this may help you
http://wiki.roblox.com/index.php/Collision_detection_for_GUIs
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
06 Feb 2014 08:21 PM
meh, thats the same confusing wiki, but ok.
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
06 Feb 2014 08:21 PM
nvm, its completely different :D
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