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: Need help with a "GUI Remover"

Previous Thread :: Next Thread 
RoBloxBossk is not online. RoBloxBossk
Joined: 23 May 2012
Total Posts: 44
02 Mar 2014 09:36 PM
I have A GUI that is used to remove another GUI off the screen (because from time to time the other GUI gets locked up and is unresponsive). This "GUI remover" works grate in test mode on the Roblox Studio, but when I upload it, the GUI remover doesn’t work at all.If anyone has an idea or would like to help

http://www.roblox.com/My-tricky-GUI-item?id=148191057

I would be most appreciative.

Here is a copy of the script that goes with the "GUI remover" just in case you see the problem or know of a more reliable method. "NewGame" is the name of the GUI I wish to remove.

pg= game.Players.LocalPlayer.PlayerGui
Gui= pg:FindFirstChild("NewGame") --Gui has to be in the player's PlayerGui

function onClick()
Gui:Destroy()
end

script.Parent.MouseButton1Click:connect(onClick)
Report Abuse
1billybob1 is not online. 1billybob1
Joined: 15 Jun 2008
Total Posts: 4852
02 Mar 2014 09:38 PM
Sometimes when a player enters, not everything is loaded, which can cause errors. One item that doesn't load right away is PlayerGui. This should fix it:

pg= game.Players.LocalPlayer:WaitForChild("PlayerGui")
Gui= pg:FindFirstChild("NewGame") --Gui has to be in the player's PlayerGui

function onClick()
Gui:Destroy()
end

script.Parent.MouseButton1Down:connect(onClick)
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
02 Mar 2014 09:41 PM
Why not just solve the problems with the first gui?

local Gui = game.Players.LocalPlayer.PlayerGui:FindFirstChild("NewGame")

script.Parent.MouseButton1Click:connect(function(mouse)
Gui:Destroy()
end)
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
02 Mar 2014 09:42 PM
BillyBob.. They wouldn't be able to click this if their stats weren't loaded.. So just stop lmao. *Facetrain*
Report Abuse
RoBloxBossk is not online. RoBloxBossk
Joined: 23 May 2012
Total Posts: 44
02 Mar 2014 09:53 PM
Ideally I would like to fix the problems with the first GUI but I didn't make it and it only happens under large server strain. I figure its either poorly scripted or I need to find a way to reduce the strain on the serve ether way I don't have the time right now so I’m just looking for a quick fix.
Report Abuse
RoBloxBossk is not online. RoBloxBossk
Joined: 23 May 2012
Total Posts: 44
02 Mar 2014 10:12 PM
Goulstem, I pasted in your script and in test mode I worked. However, when I uploaded it, just like the previous version it didn't work. Any Ideas anyone?
Report Abuse
RoBloxBossk is not online. RoBloxBossk
Joined: 23 May 2012
Total Posts: 44
02 Mar 2014 11:33 PM
Bump.
Report Abuse
RoBloxBossk is not online. RoBloxBossk
Joined: 23 May 2012
Total Posts: 44
03 Mar 2014 12:16 AM
After more testing, I found that the "Gui remover" works in Build Mode too. Its strange it works in a Edit mode test and in Build mode, only in play where it actually counts it doesn't work. The Gui Toggles in and out so I know I'm clicking on it.
Report Abuse
robotmega is not online. robotmega
Joined: 16 May 2009
Total Posts: 14084
03 Mar 2014 12:24 AM
make it a local script
Report Abuse
RoBloxBossk is not online. RoBloxBossk
Joined: 23 May 2012
Total Posts: 44
03 Mar 2014 12:50 AM
I found this scrip in the catalog,Its meant to be put into a brick. When a player steps on it, it removes the Gui. So I tested it out and found it not only works in a studio test, but in an uploaded server!

local ting = 0 --debouncer

function onTouched(hit)

if ting == 0 then --debounce check
ting = 1 --activate debounce
check = hit.Parent:FindFirstChild("Humanoid") --Find the human that touched the button

if check ~= nil then --If a human is found, then

local user = game.Players:GetPlayerFromCharacter(hit.Parent) --get player from touching human
local pguiw = user:findFirstChild("PlayerGui") --Find GUI folder

if pguiw ~= nil then --If playergui exists then
local wsh = pguiw:findFirstChild("gui") --Get gui u need
wsh:Remove() --remove gui listed above
wait(1) --wait-time before button works again
end

end

ting = 0 --remove debounce
end

end

script.Parent.Touched:connect(onTouched)





Would it be possible for some one to adjusts this to work as the script in my Gui?
Report Abuse
RoBloxBossk is not online. RoBloxBossk
Joined: 23 May 2012
Total Posts: 44
03 Mar 2014 08:09 PM
Bump.
Report Abuse
RoBloxBossk is not online. RoBloxBossk
Joined: 23 May 2012
Total Posts: 44
04 Mar 2014 01:19 AM
Bump.
Report Abuse
RoBloxBossk is not online. RoBloxBossk
Joined: 23 May 2012
Total Posts: 44
05 Mar 2014 06:10 PM
Bump.
Report Abuse
1billybob1 is not online. 1billybob1
Joined: 15 Jun 2008
Total Posts: 4852
05 Mar 2014 07:53 PM
@Goul

No need to be arrogant about this. I was simply trying to help. If you can't take that, then you're just plain pathetic.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
05 Mar 2014 08:06 PM
repeat
pg= game.Players.LocalPlayer.PlayerGui
Gui= pg:FindFirstChild("NewGame") --Gui has to be in the player's PlayerGui
until Gui ~= nil

function onClick()
repeat
Gui:Destroy()
until Gui == nil
end

script.Parent.MouseButton1Down:connect(onClick)
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
05 Mar 2014 08:07 PM
Try that, see what happens
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
05 Mar 2014 08:08 PM
OPPS that would have been a disaster, forgot waits


repeat
pg= game.Players.LocalPlayer.PlayerGui
Gui= pg:FindFirstChild("NewGame") --Gui has to be in the player's PlayerGui
wait(0.01)
until Gui ~= nil

function onClick()
repeat
Gui:Destroy()
wait(0.01)
until Gui == nil
end

script.Parent.MouseButton1Down:connect(onClick)
Report Abuse
RoBloxBossk is not online. RoBloxBossk
Joined: 23 May 2012
Total Posts: 44
06 Mar 2014 01:30 AM
Success! I finally clued into what Robotmega meant by “make it a local script.” Thanks a ton, to all who took the time to read and help.
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
06 Mar 2014 03:19 PM
@billy, What? If I can't take what then I'm just plain pathetic? If you're talking about his script then I don't stick to the same thread for five days soo..?
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