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 7 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 — 7y
0
Give us the script and we will fix it for u tonyv537 95 — 7y

1 answer

Log in to vote
0
Answered by
Morficc 36
7 years ago
Edited 7 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:

wait(1)
local gui = game.Players.LocalPlayer.PlayerGui.Main.GUI


function onTouch(part) 
    print('HidingBrick Touched')
local humanoid = part.Parent:FindFirstChild("Humanoid") 
if (humanoid ~= nil) then -- if a humanoid exists, then 

gui.HidingLabel.Visible = true
wait(1)
gui.HidingLabel.Visible = false
gui.Visible = false
end 
end 

script.Parent.Touched:connect(onTouch)

VisibleBrick/VisibleScript:

wait(1)
local gui = game.Players.LocalPlayer.PlayerGui.Main.GUI


function onTouch(part) 
    print('HidingBrick Touched')
local humanoid = part.Parent:FindFirstChild("Humanoid") 
if (humanoid ~= nil) then -- if a humanoid exists, then 

gui.Visible = true
gui.VisibleLabel.Visible = true
wait(1)
gui.VisibleLabel.Visible = false


end 
end 

script.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 — 7y
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 — 7y
Ad

Answer this question