Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

TextButton.Visible = true not working?

I am trying to make an Intro GUI. Everything is working except for my TextButton. When I test the intro gui the sound, frame, textlabel, and imagelabel work. I am trying to make it where after a certain amount of seconds the TextButton will become visible. I was also trying to make where if the button is clicked all the frames and screen guis would faded or disappear. In addition, would also like to add a MouseHoverEnter which I have no clue how to do.

Here is a link to an image of what my ScreenGUI contains.

https://gyazo.com/7d45c90ebfa03d884949ee859c251e18

TextButton Script:

local textlabel = script.Parent.Parent:WaitForChild('TextLabel')
local textlabel1 = script.Parent.Parent:WaitForChild('TextLabel1')
local frame = script.Parent.Parent
local frame1 = script.Parent.Parent:WaitForChild('Frame1')
local image = script.Parent.Parent:WaitForChild('ImageLabel')
local textbutton = script.Parent:WaitForChild('TextButton')

wait(6.5)
script.Parent.Visible = true
script.Parent.MouseButton1Click:connect(function()
	for i = 0,0.5,1 do
		script.Parent.Parent.BackgroundTransparency = i
		textlabel.Visible = false
		textlabel1.Visible = false
		image.Visible = false
		textbutton.Visible = false
		frame1.Visible = false
		wait(0.05)
	end
	script.Parent.Parent.Sound:Stop()
	
end)

Other Script inside of the Frame:

wait(2)
local textlabel = script.Parent:WaitForChild('TextLabel')
local textlabel1 = script.Parent:WaitForChild('TextLabel1')
local frame = script.Parent
local frame1 = script.Parent:WaitForChild('Frame1')
local image = script.Parent:WaitForChild('ImageLabel')
local textbutton = script.Parent:WaitForChild('TextButton')
script.Parent.Sound:Play()
wait(1)
frame1:TweenPosition(UDim2.new(0,2000,0,250),'In',4)
wait(4)
frame1:TweenPosition(UDim2.new(0,0,0,250),'In',4)
wait(1.5)
image.Visible = true



Please help me, thank you!

1 answer

✓ Accepted answer

You made a small error when setting up your variables in the TextButton script. When getting the variable for the TextButton itself, you say local textbutton = script.Parent:WaitForChild('TextButton'). The issue is that the TextButton is actually just script.Parent, so this statement will yield forever (which means that nothing after it will run properly).

I've rewritten your code below, and prettied it up a little bit. I also changed your 'fade' effect, as how you wrote it wouldn't run properly. You set an interval of 0 to 0.5, with an increment of 1. I presumed you meant an increment of 0.1, as seen below. For the most part though, I left your code how you originally wrote it.

--// Objects
local TextButton	= script.Parent
local Frame			= TextButton.Parent
local TextLabel		= Frame:WaitForChild("TextLabel")
local TextLabel1	= Frame:WaitForChild("TextLabel1")
local Frame1		= Frame:WaitForChild("Frame1")
local ImageLabel	= Frame:WaitForChild("ImageLabel")
local Sound			= Frame:WaitForChild("Sound")

wait(6.5)
TextButton.Visible = true
TextButton.MouseButton1Click:Connect(function()
	for i = 0,0.5,0.1 do
		Frame.BackgroundTransparency = i
		TextLabel.Visible = false
		TextLabel1.Visible = false
		ImageLabel.Visible = false
		TextButton.Visible = false
		Frame1.Visible = false
		wait(0.05)
	end
	Sound:Stop()
end)

If this still doesn't solve your problem, feel free to ask any more questions! -Poe

2 comments

0

Hey Poe! Thanks for help. But unfortunely the first Frame doesn't disappear when I click the textbutton.

0

Nevermind I have fixed it.

This discussion is preserved as it was. New answers, comments, and votes are closed.