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: Click detection

Previous Thread :: Next Thread 
Seeumliam is not online. Seeumliam
Joined: 06 May 2013
Total Posts: 5662
23 May 2014 09:05 AM
I have a script inside of a ClickDetection inside a Part

script.Parent.Touched:connect(function(hit)
char = hit.Parent:FindFirstChild("Humanoid")
player = game.Players:GetPlayerFromCharacter(char.Parent)
phonez = player.PlayerGui.phone

if phonez.questgroup.back1.all.b.Visible == true and phonez.questgroup.back2.all.b.Visible == false and phonez.questgroup.back3.all.b.Visible == false then

phonez.questgroup.back1.all.b.Visible = false
phonez.questgroup.back1.all.b.Visible = true
phonez.questgroup.back1.all.b.Visible = false
phonez.newquest.Transparency = 1
phonez.newquest.Transparency = 1
phonez.newquest.Transparency = 1
phonez.newquest.Transparency = 1
phonez.newquest.Transparency = 1
phonez.newquest.Transparency = 1
phonez.newquest.Transparency = 1
phonez.newquest.Transparency = 1
phonez.newquest.Transparency = 1
phonez.newquest.Transparency = 1


end
end)


It doesn't seem to work, but it gives me the click icon when hovering over it.
Report Abuse
xSpectrumWolfx is not online. xSpectrumWolfx
Joined: 30 Nov 2011
Total Posts: 2858
23 May 2014 09:23 AM
Anything in output?
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
23 May 2014 09:25 AM
May I ask why you set the transparency to 1 10 times?

-[::ƧѡÎḾḠΰῩ::]-[::Helper of Scripting and Writer of Wikis::]
Report Abuse
Seeumliam is not online. Seeumliam
Joined: 06 May 2013
Total Posts: 5662
23 May 2014 09:27 AM
I'm changing that, The first line is where the problem is I think.
Report Abuse
xSpectrumWolfx is not online. xSpectrumWolfx
Joined: 30 Nov 2011
Total Posts: 2858
23 May 2014 09:29 AM
Why don't you have any wait's? I don't believe you'd notice it working if you don't add some sort of pause in the script.
Report Abuse
Seeumliam is not online. Seeumliam
Joined: 06 May 2013
Total Posts: 5662
23 May 2014 09:30 AM
Should the first line be Touched If it is being clicked?
Report Abuse
xSpectrumWolfx is not online. xSpectrumWolfx
Joined: 30 Nov 2011
Total Posts: 2858
23 May 2014 09:32 AM
If this was in a click function it would be a problem, however this supposed to run only to a touched function.
Report Abuse
xSpectrumWolfx is not online. xSpectrumWolfx
Joined: 30 Nov 2011
Total Posts: 2858
23 May 2014 09:33 AM
Wait, the function is connected to the Click Detector, er, not a good idea if you ask me. That may be why it's not working.
Report Abuse
Seeumliam is not online. Seeumliam
Joined: 06 May 2013
Total Posts: 5662
23 May 2014 09:34 AM
How would I make it a click function?
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
23 May 2014 09:37 AM
You would use the MouseClicked event instead of the .Touched event. Since the MouseClicked event has the player who clicked as a parameter you don't need to set all of those variables trying to get the player.

Your first 4 lines should look like this:

script.Parent.Touched:connect(function(player)
phonez = player.PlayerGui.phone

-[::ƧѡÎḾḠΰῩ::]-[::Helper of Scripting and Writer of Wikis::]
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
23 May 2014 09:38 AM
Whoops, like this:

script.Parent.MouseClicked:connect(function(player)
phonez = player.PlayerGui.phone

-[::ƧѡÎḾḠΰῩ::]-[::Helper of Scripting and Writer of Wikis::]

Report Abuse
Seeumliam is not online. Seeumliam
Joined: 06 May 2013
Total Posts: 5662
23 May 2014 09:43 AM
Is the script suppose to be in script detector? If do then it says MouseClicked is not a valid member of click detector.
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
23 May 2014 09:44 AM
Oops, it should be MouseClick, not MouseClicked.

-[::ƧѡÎḾḠΰῩ::]-[::Helper of Scripting and Writer of Wikis::]
Report Abuse
Seeumliam is not online. Seeumliam
Joined: 06 May 2013
Total Posts: 5662
23 May 2014 10:05 AM
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