UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 31 Mar 2013 04:42 PM |
How can I make this work with left and right click?
if Workspace.GameScript.LoadedPlayers:FindFirstChild(script.Parent.Parent.Parent.Parent.Name) ~= nil then --Checks if the value is already there
wait(0.03) --Waits to keep script from erroring
Game.Debris:AddItem(script.Parent.Parent,0.3) --Destroys the gui
end --Ends checking if the value is already there
script.Parent.Visible = true --Makes the gui visible
function OnClicked() --Checks for clicks
if Workspace.GameScript.LoadedPlayers:FindFirstChild(script.Parent.Parent.Parent.Parent.Name) == nil then --Makes sure the value isn't already there
Instance.new("Model", Workspace.GameScript.LoadedPlayers).Name = script.Parent.Parent.Parent.Parent.Name --Creates LoadedPlayer model
Game.Debris:AddItem(script.Parent.Parent,0.03) --Destroys the gui
end --Ends making sure the value isn't already there
end --Ends checking or clicks
script.Parent.MouseButton1Down:connect(OnClicked) --Sets button |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2013 04:44 PM |
| Use the MouseButton2Down event for a right-click. |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2013 04:44 PM |
| Being the noob that I am, I just make 2 scripts, one with left the other with right. |
|
|
| Report Abuse |
|
|
dekkonot
|
  |
| Joined: 22 Dec 2010 |
| Total Posts: 6685 |
|
|
| 31 Mar 2013 04:44 PM |
| I'm farely certain that MouseButton2Down doesn't work yet...that might be in Mouse though... |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2013 04:45 PM |
I believe they have added Button2Down functionality to tools, and MouseButton2Down functionality to GUIs. :)
We've only been asking for them for 4+ years. Haha. |
|
|
| Report Abuse |
|
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 31 Mar 2013 04:46 PM |
@AgentFirefox How can I make it work within one script though? |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2013 04:50 PM |
Just add another connection.
script.Parent.MouseButton2Down:connect(OnClicked) |
|
|
| Report Abuse |
|
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 31 Mar 2013 04:51 PM |
end --Ends making sure the value isn't already there
end --Ends checking or clicks
script.Parent.MouseButton1Down:connect(OnClicked) --Sets button
script.Parent.MouseButton2Down:connect(OnClicked) --Sets second button
As simply as that?
See I was right I do look stupid x3 |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2013 04:53 PM |
Yes, it was that simple. A lot of people get confused seeing two connection lines, especially using the same function, when they begin scripting. I myself was confused when I saw multiple connections for the first time. I always did one script = one connection. XD
Now I do one script = everything. So much easier to manage. :) |
|
|
| Report Abuse |
|
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 31 Mar 2013 04:59 PM |
@Agent Look in your inbox please |
|
|
| Report Abuse |
|
|