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: How would I make a part when clicked show a GUI?

Previous Thread :: Next Thread 
DavyJones118 is not online. DavyJones118
Joined: 07 Jun 2011
Total Posts: 370
20 Jan 2012 04:54 PM
I am wondering how I could make a part show a GUI.
Here is probably how it would work

-Click Detector in the part

function openup()

script.Parent.Parent.Parent.StarterGUI.ScreenGUI.Frame.Visible = true
end

script.Parent.MouseButton1Down:connect(openup)

Would that work? Just to confirm.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
20 Jan 2012 04:58 PM
No. You would use the clickdetector mouseclick function, once activated, access the player's PlayerGui, then make it show it.

† KMXD †
Report Abuse
DavyJones118 is not online. DavyJones118
Joined: 07 Jun 2011
Total Posts: 370
20 Jan 2012 05:04 PM
So how would that work, something like?

gui = game.Lighting.clickedgui

function click()

gui:clone().Parent = player.PlayerGui
wait() --to let the computer know it can take its time
theGUI = game.Lighting.YOURGUINAME

end

script.Parent.Clicked:connect(click)

i really am not advanced with clicked stuff except MouseButton1Down
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
20 Jan 2012 05:05 PM
It's ok, just wait a sec to look for something.

† KMXD †
Report Abuse
DavyJones118 is not online. DavyJones118
Joined: 07 Jun 2011
Total Posts: 370
20 Jan 2012 05:05 PM
Scrap the line
theGUI = game.Lighting.YOURGUINAME
I actually meant
script.Parent.Clicked:connect(click)
but then i forgot an
end
so my mind wandered
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
20 Jan 2012 05:09 PM
Hm try:

p = game.Players.LocalPlayer

script.Parent.ClickDetector.MouseClick:connect(function()
if p ~= nil then
p:FindFirstChild("StarterGui").ScreenGui.Frame.Visible = true
end
end)

?

† KMXD †
Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
20 Jan 2012 05:18 PM
MouseClick now has an argument to get the player, i haven't used it yet, but i think it just works like this:

script.Parent.ClickDetector.MouseClick:connect(function(p)
if p ~= nil then
p:FindFirstChild("StarterGui").ScreenGui.Frame.Visible = true
end
end)


~I've been to nil and back.
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