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: Right Clicking Script Doesn't Work.

Previous Thread :: Next Thread 
1billybob1 is not online. 1billybob1
Joined: 15 Jun 2008
Total Posts: 4852
07 Nov 2012 07:14 PM
game.Players.PlayerAdded:connect(function(player)
game.Players.player.PlayerGui.FlashLight.Script.MouseButton2Click:connect()
f = game.Players.player.PlayerGui.FlashLight
l = f.Left
m = f.Main
r = f.Right
if f.l.Active == true then
f.l.Active = false
f.r.Active = false
f.m.Active = false
else
f.l.Active = true
f.r.Active = true
f.m.Active = true
end
end)



No output errors. And what I basically want it to do is, either turn on or off the flashlight gui. If it's off, then it gets turned on, and vice versa. Please, help.
Report Abuse
nightmare3o is not online. nightmare3o
Joined: 21 Jun 2008
Total Posts: 956
07 Nov 2012 07:16 PM
To me it looks like you're clicking a script instead of a button.
Report Abuse
nightmare3o is not online. nightmare3o
Joined: 21 Jun 2008
Total Posts: 956
07 Nov 2012 07:17 PM
My bad there's no button t_t
Report Abuse
1billybob1 is not online. 1billybob1
Joined: 15 Jun 2008
Total Posts: 4852
07 Nov 2012 07:19 PM
Added a button. Script now (still not working)

game.Players.PlayerAdded:connect(function(player)
game.Players.player.PlayerGui.FlashLight.TextButton.MouseButton2Click:connect()
f = game.Players.player.PlayerGui.FlashLight
l = f.Left
m = f.Main
r = f.Right
if f.l.Active == true then
f.l.Active = false
f.r.Active = false
f.m.Active = false
else
f.l.Active = true
f.r.Active = true
f.m.Active = true
end
end)
Report Abuse
nightmare3o is not online. nightmare3o
Joined: 21 Jun 2008
Total Posts: 956
08 Nov 2012 05:26 PM
Do you have a model? It'd be much easier for me to see what's wrong.
Report Abuse
1billybob1 is not online. 1billybob1
Joined: 15 Jun 2008
Total Posts: 4852
08 Nov 2012 05:28 PM
No, but heres what it is.

In StarterGui, there is a Gui named, "FlashLight" Inside contains 5 things, Left (picture) Main (picture) Right (picture) Script (obviously a script, which is what is the problem) and TextButton

The script is LOCATED in the Flashlight gui
Report Abuse
nightmare3o is not online. nightmare3o
Joined: 21 Jun 2008
Total Posts: 956
08 Nov 2012 05:29 PM
game.Players.PlayerAdded:connect(function(player)
game.Players.player.PlayerGui.FlashLight.TextButton.MouseButton2Click:connect()
f = game.Players.player.PlayerGui.FlashLight
l = f.Left
m = f.Main
r = f.Right
if l.Active == true then
l.Active = false
r.Active = false
m.Active = false
else
l.Active = true
r.Active = true
m.Active = true
end
end)

Try it like this?
Report Abuse
buddy249950 is not online. buddy249950
Joined: 30 Jun 2016
Total Posts: 3536
08 Nov 2012 05:30 PM
I already told you how to fix this in another thread. StarterGui just holds the GUIs. You have to change the PlayerGui to see an effect.
Report Abuse
1billybob1 is not online. 1billybob1
Joined: 15 Jun 2008
Total Posts: 4852
08 Nov 2012 05:30 PM
I did. I changed it to PlayerGui.
Report Abuse
1billybob1 is not online. 1billybob1
Joined: 15 Jun 2008
Total Posts: 4852
08 Nov 2012 05:31 PM
See, right here (just a section of the script)
game.Players.PlayerAdded:connect(function(player)
game.Players.player.PlayerGui.FlashLight.Script.MouseButton2Click:connect()
f = game.Players.player.PlayerGui.FlashLight
l = f.Left
Report Abuse
1billybob1 is not online. 1billybob1
Joined: 15 Jun 2008
Total Posts: 4852
08 Nov 2012 05:58 PM
Bump Help!
Report Abuse
SirGalith is not online. SirGalith
Joined: 24 Jan 2010
Total Posts: 209
08 Nov 2012 06:35 PM
try MouseButton2Down instead of MouseButton2Click
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
08 Nov 2012 06:41 PM
When a Player is Added, the PlayerGui and GUIs in it don't yet Exist


repeat wait() until ply:findFirstChild("PlayerGui")
repeat wait() until ply.PlayerGui:findFirstChild("Flashlight")
Report Abuse
XhymbbQd6 is not online. XhymbbQd6
Joined: 22 Jul 2011
Total Posts: 1468
08 Nov 2012 06:41 PM
I am pretty sure its MouseButton2Down... And or Up. I use that for my Guis.
Report Abuse
SirGalith is not online. SirGalith
Joined: 24 Jan 2010
Total Posts: 209
08 Nov 2012 06:48 PM
Y does he have to access the textButton by


game.Players.player.FlashLight.TextButton


instead of

script.Parent.TextButton
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
08 Nov 2012 06:49 PM
game.Players.PlayerAdded:connect(function(player)
game.Players.player.PlayerGui.FlashLight.Script.MouseButton2Click:connect()
f = game.Players.player.PlayerGui.FlashLight




SHOULD BE:



game.Players.PlayerAdded:connect(function(player)
player.PlayerGui.FlashLight.Script.MouseButton2Click:connect()
f = player.PlayerGui.FlashLight
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