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 » Scripters
Home Search
 

Re: Question about Gui

Previous Thread :: Next Thread 
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
14 Jul 2015 06:38 PM
Is it possible to open a gui by clicking on a part with a local script?
I tried to make a billboard , but when I wanted to verify if the player name had the same name then then the model it didn't work ,but if I removed the condition it worked,but I want it to only open if the player is the owner of the model.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
14 Jul 2015 06:48 PM
First, post the code. Here is also a template.

script.Parent.ClickDetector.MouseClick:connect(function(player)
--code
end)


"Talk is cheap. Show me the code." - Linus Torvalds
Report Abuse
gooey333 is not online. gooey333
Joined: 24 Mar 2013
Total Posts: 1208
14 Jul 2015 06:55 PM
Yes

game.Workspace.Part.ClickDetector.MouseClick:connect(function()
script.Parent.Visible = true
require(Whatever you need to set up the gui)
end)
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
14 Jul 2015 07:01 PM
@gooey, You don't need to use a module script for this simple thing. thats overkill.


"Talk is cheap. Show me the code." - Linus Torvalds
Report Abuse
gooey333 is not online. gooey333
Joined: 24 Mar 2013
Total Posts: 1208
14 Jul 2015 07:10 PM
Its for the gui setup, its not overkill. I know what I'm doing.
Report Abuse
gooey333 is not online. gooey333
Joined: 24 Mar 2013
Total Posts: 1208
14 Jul 2015 07:10 PM
If you were opening a shop or something, you would want to use a ModuleScript to set it up
Report Abuse
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
14 Jul 2015 07:12 PM
Here's the script.

Keep = script.Parent
Gui = Keep.Gui
player = game.Players.LocalPlayer
open = true

function click()
if player.Name == Keep.Name then
if open == true then
Gui.Enabled = false
open = false
elseif Gui.Enabled == false then
Gui.Enabled = true
open = true
end
end
end

Keep.ClickDetector.MouseClick:connect(click)
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
14 Jul 2015 07:14 PM
Good for you to know what youre doing. But I'm saying what you are doing is overkill. A module isn't needed, and especially for someone like him. Keep it simple.


"Talk is cheap. Show me the code." - Linus Torvalds
Report Abuse
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
14 Jul 2015 07:18 PM
So what do I do now? And I dont wanna do a shop. I just want that only the player that have the same name of his building can open it.Unless he can't. If I remove this condition the stuff work but everyone can open/close. ;/
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
14 Jul 2015 07:20 PM
Here is a little bit of code you could use.

script.Parent.ClickDetector.MouseClick:connect(function(player)
local gui = player.PlayerGui:WaitForChild("ScreenGui")
local frame = gui.Frame
if player.Name == script.Parent.Name then
frame.Visible = not frame.Visible
end
end)


"Talk is cheap. Show me the code." - Linus Torvalds
Report Abuse
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
14 Jul 2015 07:25 PM
I tried before to put the gui just as a screen gui in the starter gui and to toggle the frame visible, but when I tried.. It didn't work at all.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
14 Jul 2015 07:29 PM
Post any outpute and look at your script analysis. This should be a server script in a BasePart with click detector in it.


"Talk is cheap. Show me the code." - Linus Torvalds
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
14 Jul 2015 07:30 PM
Also, the parent should be the players name. If this is a model, you need to put the script in the brick then do

script.Parent.Parent.Name


"Talk is cheap. Show me the code." - Linus Torvalds
Report Abuse
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
14 Jul 2015 07:50 PM
It was aleardy that......
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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