Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

GUI Background not going invisible?

Asked by 8 years ago

Trying to make a GUI so that when you step on a brick, it says hiding and makes it go invisible, and step on another it says visible (and makes it re-appear), but when stepping on the brick to make it invisible, the text box goes invisible, but not the background? (The text re-appear's when I step on the one to make it visible.)

0
And why haven't you posted the script you're using to do this? GoldenPhysics 474 — 8y
0
Give us the script and we will fix it for u tonyv537 95 — 8y

1 answer

Log in to vote
0
Answered by
Morficc 36
8 years ago
Edited 8 years ago

Not entirely sure what you are trying to accomplish, but I gave it my best shot.

I created two parts in Workspace, and inserted a Script into each (Not a Localscript).

HidingBrick/HidingScript:

01wait(1)
02local gui = game.Players.LocalPlayer.PlayerGui.Main.GUI
03 
04 
05function onTouch(part)
06    print('HidingBrick Touched')
07local humanoid = part.Parent:FindFirstChild("Humanoid")
08if (humanoid ~= nil) then -- if a humanoid exists, then
09 
10gui.HidingLabel.Visible = true
11wait(1)
12gui.HidingLabel.Visible = false
13gui.Visible = false
14end
15end
16 
17script.Parent.Touched:connect(onTouch)

VisibleBrick/VisibleScript:

01wait(1)
02local gui = game.Players.LocalPlayer.PlayerGui.Main.GUI
03 
04 
05function onTouch(part)
06    print('HidingBrick Touched')
07local humanoid = part.Parent:FindFirstChild("Humanoid")
08if (humanoid ~= nil) then -- if a humanoid exists, then
09 
10gui.Visible = true
11gui.VisibleLabel.Visible = true
12wait(1)
13gui.VisibleLabel.Visible = false
14 
15 
16end
17end
18 
19script.Parent.Touched:connect(onTouch)

I then created a "ScreenGui" object into "StarterGui". I named this "Main"

Under Main I created a "Frame" object, named, "GUI"

Under GUI, I created two TextLabels named, "HidingLabel" and "VisibleLabel". I set the text for HidingLabel to "Hiding". and VisibleLabel to "Visible". I then made both of these TextLabels not visible.

Works pretty well for me, but again.. not really sure if that is what you meant.

0
Thank's alot dude! I'm amazed at how small the block of code was compared to mine. Heh. It worked amazingly. Thanks a bunch. I'll use this instead now. :D armyguy675 2 — 8y
0
My pleasure! I am sure there is a better way to do this (There always is), but I am glad that this worked for you. :) Morficc 36 — 8y
Ad

Answer this question