|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
|
| 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
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
| |
|
|
| 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 |
|
|
| |
|
| |
|
| |
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 05 Mar 2014 08:07 PM |
| Try that, see what happens |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|