|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 18 Dec 2013 09:29 PM |
^ He doesn't have to have anything in it, but he does need an end. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 18 Dec 2013 09:31 PM |
flatline...
That is exactly the same as my code. Just different variables? |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 18 Dec 2013 09:37 PM |
Wait what...
I need the children of the target... so..
targChild = mouse.Target:GetChildren() |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2013 09:39 PM |
| Oh I read it wrong, sorry. |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2013 09:40 PM |
| It's fine. Can anyone help me with the problem of it not functioning? |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2013 09:42 PM |
| Oh oops. There was a gui visible just full transparency. *facepalm* |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 19 Dec 2013 02:16 PM |
| MouseButton1Down() is the function for detecting clicking |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 19 Dec 2013 05:07 PM |
| Button1Down isn't just for hopperbins. And it works fine, so stop bumping please. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|