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: Probably something really simple and I will look stupid

Previous Thread :: Next Thread 
UnBuild is not online. 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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
31 Mar 2013 04:44 PM
Use the MouseButton2Down event for a right-click.
Report Abuse
Awsomisticguy537 is not online. Awsomisticguy537
Joined: 03 Dec 2010
Total Posts: 507
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 is not online. 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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
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 is not online. 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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
31 Mar 2013 04:50 PM
Just add another connection.


script.Parent.MouseButton2Down:connect(OnClicked)
Report Abuse
UnBuild is not online. 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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
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 is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
31 Mar 2013 04:59 PM
@Agent
Look in your inbox please
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