Problem with TextButton visibility

  1. What do you want to achieve? For the TextButton to disappear when clicked.

  2. What is the issue? It does not disappear, the code does not work as intended.

  3. What solutions have you tried so far? Did some troubleshooting and suspecting there’s an issue with detecting the click or possible with the before statements of Button.Visiblity = true.

Here’s the whole code:

local TextLabel = script.Parent:WaitForChild("Frame"):WaitForChild("TextLabel")
local napp1 = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.nappula1 
local napp2 = script.Parent.Frame.nappula2
local napp3 = script.Parent.Frame.nappula3
local napp4 = script.Parent.Frame.nappula4

wait(4)

local function typewrite(object,text)
	for i = 1,#text,1 do
		object.Text = string.sub(text,1,i)
		wait(0.04)
	end
end

typewrite(TextLabel,"You have been chosen to parttake in this quiz - your future will be decided here.")
wait (4)
typewrite(TextLabel,"The first question:")
wait (3.5)
typewrite(TextLabel,"If you pick an answer to this question at random, what is the chance that you will be correct?")
wait (1)
script.Parent.Frame.nappula1.Visible = true
script.Parent.Frame.nappula2.Visible = true
script.Parent.Frame.nappula3.Visible = true
script.Parent.Frame.nappula4.Visible = true

game.StarterGui.ScreenGui.Frame.nappula1.Activated:Connect(function()  -- Problem Part
	napp1.Visible = false
end)
2 Likes

What about this part? Its setting the UI to false.

1 Like

Yeah, I want the Visibility of it to go false when I click the button.

1 Like
local napp1 = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.nappula1

try to use waitforchild except .
I had same problem with detecting a thing in playerGui

ohh nvm, i see the problem,

game.StarterGui.ScreenGui.Frame.nappula1.Activated:Connect(function()

instead try

napp1.Activated:Connect(function()
napp1.Visible = false
end)
1 Like

Just remember to declare everything with starterGui in game.Players.LocalPlayer.PlayerGui.(yourGui), good luck.
and also. This won’t work too.

script.Parent.Frame.nappula1.Visible = true
script.Parent.Frame.nappula2.Visible = true
script.Parent.Frame.nappula3.Visible = true
script.Parent.Frame.nappula4.Visible = true
local TextLabel = script.Parent:WaitForChild("Frame"):WaitForChild("TextLabel")
local napp1 = script.Parent:WaitForChild("Frame"):WaitForChild("nappula1") 
local napp2 = script.Parent:WaitForChild("Frame"):WaitForChild("nappula2")
local napp3 = script.Parent:WaitForChild("Frame"):WaitForChild("nappula3")
local napp4 = script.Parent:WaitForChild("Frame"):WaitForChild("nappula4")

task.wait(4)
local function typewrite(object,text)
	for i = 1,#text,1 do
		object.Text = string.sub(text,1,i)
		task.wait()
	end
end

typewrite(TextLabel,"You have been chosen to parttake in this quiz - your future will be decided here.")
task.wait(6)
typewrite(TextLabel,"The first question:")
task.wait(3)
typewrite(TextLabel,"If you pick an answer to this question at random, what is the chance that you will be correct?")
task.wait(6)
napp1.Visible = true
napp2.Visible = true
napp3.Visible = true
napp4.Visible = true

napp1.Activated:Connect(function()  -- Problem Part
	napp1.Visible = false
end)

You don’t need to reference “PlayerGui” when manipulating UI in the StarterGui, providing the local script is located inside the “StarterGui” folder the above script will work. Just make sure it’s placed correctly.