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: Detecting Clicking?

Previous Thread :: Next Thread 
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
18 Dec 2013 09:26 PM
So I have this:

plr = game.Players.LocalPlayer
mouse = plr:GetMouse()


mouse.Button1Down:connect(function()

But it doesn't function when the player clicks...

This is in a localscript inside PlayerGui.Master (Master is a screengui)
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
18 Dec 2013 09:27 PM
mouse.Button1Down:connect(function()
print("u need something to print or execute and an end :P")
end)

"U BROKE THE TV U IDIOT!" - CeaselessSoul
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
18 Dec 2013 09:28 PM
Oh, and make sure it's disabled and if it doesn't work add a wait(0.1) as the first line of code.

"U BROKE THE TV U IDIOT!" - CeaselessSoul
Report Abuse
JoshuaKempfert is not online. JoshuaKempfert
Joined: 16 Feb 2013
Total Posts: 2407
18 Dec 2013 09:29 PM
^
He doesn't have to have anything in it, but he does need an end.
Report Abuse
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
18 Dec 2013 09:29 PM
Ceaseless, I just posted that part this is the entire function:

print'1'
plr = game.Players.LocalPlayer
mouse = plr:GetMouse()


mouse.Button1Down:connect(function()
print'2'
targChild = mouse.Target:GetChildren()
for i=1, #targChild do
print'3'
if targChild[i].Value == "IsItem" then
print'4'
slotAmount = plr.PlayerGui.Master.InvMain.SlotFrame:GetChildren()
for i=1, #slotAmount do
print'5'
if slotAmount[i].Holding == nil then
print'6'
slotAmount[i].Holding = mouse.Target
mouse.Target.Parent = ReplicatedStorage
else
print(slotAmount[i])
end
end
end
end
print(mouse.Target.Name)
end)
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
18 Dec 2013 09:29 PM
local player, mouse = game.Players.LocalPlayer, game.Players.LocalPlayer:GetMouse();
mouse.Button1Down:connect(function()
thing = mouse.Target;
if thing then


end;
end);
Report Abuse
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
18 Dec 2013 09:31 PM
flatline...

That is exactly the same as my code. Just different variables?
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
18 Dec 2013 09:31 PM
@Josh, I know that, but how would you know if it works without executing some code?

"U BROKE THE TV U IDIOT!" - CeaselessSoul
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
18 Dec 2013 09:32 PM
No. Your code just... Makes 0 sense.

:GetChildren on mouse.Target... wat? mouse.Target doesn't return a table.
Report Abuse
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
18 Dec 2013 09:36 PM
Then what is mouse.Target? Is it an object or what?

Anyways this isn't the problem, the function isn't starting at all.
Report Abuse
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
18 Dec 2013 09:37 PM
Wait what...

I need the children of the target... so..

targChild = mouse.Target:GetChildren()
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
18 Dec 2013 09:39 PM
Oh I read it wrong, sorry.
Report Abuse
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
18 Dec 2013 09:40 PM
It's fine. Can anyone help me with the problem of it not functioning?
Report Abuse
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
18 Dec 2013 09:42 PM
Oh oops. There was a gui visible just full transparency. *facepalm*
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
19 Dec 2013 02:16 PM
MouseButton1Down() is the function for detecting clicking
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
19 Dec 2013 04:29 PM
^ Yeah, for GUIs, but this is for the Player's mouse...

"U BROKE THE TV U IDIOT!" - CeaselessSoul
Report Abuse
longbow12 is not online. longbow12
Joined: 20 Sep 2008
Total Posts: 565
19 Dec 2013 04:46 PM
Try MouseButton1Down in the connect line, Button1Down is for hopperbins.
Report Abuse
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
19 Dec 2013 05:07 PM
Button1Down isn't just for hopperbins. And it works fine, so stop bumping please.
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
19 Dec 2013 05:56 PM
@long, why would you post if you have no idea what you're talking about? (sorry for bumping, Piggy)

"U BROKE THE TV U IDIOT!" - CeaselessSoul
Report Abuse
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
19 Dec 2013 05:59 PM
It's fine. Just don't want to fill the scripting helpers front page with a pointless thread.
Report Abuse
longbow12 is not online. longbow12
Joined: 20 Sep 2008
Total Posts: 565
19 Dec 2013 06:35 PM
@ ceasless just repeating what some1 told me, as u lot clearly weren't helping.
Report Abuse
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
19 Dec 2013 06:42 PM
"as u lot clearly weren't helping."

They were trying to help, and the problem ended up being a .Visible screengui blocking mouse detection. So it isn't their fault. Now stop bumping this thread.
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
19 Dec 2013 10:14 PM
(I'll stop posting after this) @long, by your logic you weren't helping either. Also, why would you repeat something that has already been said and that is a false statement? Why would you post when the thread was helped? Now, I can tell your next argument: "Oh, well, you're posting when this thread was helped." My reason: To set you straight.

"U BROKE THE TV U IDIOT!" - CeaselessSoul
Report Abuse
longbow12 is not online. longbow12
Joined: 20 Sep 2008
Total Posts: 565
20 Dec 2013 01:43 PM
Lol pls you didn't set me straight, I thought what I was saying was correct, plus I replied when the thread was helped cuz I ain't havin some punk like u say crap to me.
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