SurfaceGUI not working

Hello! I’m basically trying to make an interactive SurfaceGUI (a computer monitor screen like). However, it doesn’t work at all. It does fade in, but clicking any of the first (Question1) buttons (Answers) doesn’t do anything.

Any idea what is causing this?

Also if somebody got some tips on how to make the script more clear, would be appreciated. I feel like it’s being too repeated and complex for no reason, not sure how to make it simplified tho.

The code: (it’s cut off, there is more below it, but I believe that it doesn’t really matter as even this doesn’t work)

if player:GetRoleInGroup(groupId) == groupRank then
	repeat wait() until player.CharacterAdded
	wait(10)
	local Holder = workspace.Buildings["FBI TRAINING ACADEMY"].ATDesk.Screen.Screen.SurfaceGui.Holder
	local CorrectAnswers = Holder.CorrectAnswers
	for i = 1,25 do
		wait()
		Holder.Logo.ImageTransparency = (0+(0.05*i))
	end
	wait(1)
	Holder.Question1.Answer1.Active = true
	Holder.Question1.Answer2.Active = true
	Holder.Question1.Answer3.Active = true
	Holder.Question1.Answer4.Active = true
	for i = 1,25 do
		wait()
		Holder.Question1.BackgroundTransparency = (1-(0.05*i))
		Holder.Question1.Answer1.BackgroundTransparency = (1-(0.05*i))
		Holder.Question1.Answer1.TextTransparency = (1-(0.05*i))
		Holder.Question1.Answer2.BackgroundTransparency = (1-(0.05*i))
		Holder.Question1.Answer2.TextTransparency = (1-(0.05*i))
		Holder.Question1.Answer3.BackgroundTransparency = (1-(0.05*i))
		Holder.Question1.Answer3.TextTransparency = (1-(0.05*i))
		Holder.Question1.Answer4.BackgroundTransparency = (1-(0.05*i))
		Holder.Question1.Answer4.TextTransparency = (1-(0.05*i))
		Holder.Question1.Question.TextTransparency = (1-(0.05*i))
	end
	local function fadein1()
		Holder.Question1.Answer1.Active = false
		Holder.Question1.Answer2.Active = false
		Holder.Question1.Answer3.Active = false
		Holder.Question1.Answer4.Active = false
		Holder.Question2.Answer1.Active = true
		Holder.Question2.Answer2.Active = true
		Holder.Question2.Answer3.Active = true
		Holder.Question2.Answer4.Active = true
		for i = 1,25 do
			wait()
			Holder.Question2.BackgroundTransparency = (1-(0.05*i))
			Holder.Question2.Answer1.BackgroundTransparency = (1-(0.05*i))
			Holder.Question2.Answer1.TextTransparency = (1-(0.05*i))
			Holder.Question2.Answer2.BackgroundTransparency = (1-(0.05*i))
			Holder.Question2.Answer2.TextTransparency = (1-(0.05*i))
			Holder.Question2.Answer3.BackgroundTransparency = (1-(0.05*i))
			Holder.Question2.Answer3.TextTransparency = (1-(0.05*i))
			Holder.Question2.Answer4.BackgroundTransparency = (1-(0.05*i))
			Holder.Question2.Answer4.TextTransparency = (1-(0.05*i))
			Holder.Question2.Question.TextTransparency = (1-(0.05*i))
		end
	end
	local function fadein2()
		Holder.Question2.Answer1.Active = false
		Holder.Question2.Answer2.Active = false
		Holder.Question2.Answer3.Active = false
		Holder.Question2.Answer4.Active = false
		for i = 1,25 do
			wait()
			Holder.Question3.BackgroundTransparency = (1-(0.05*i))
			Holder.Question3.Answer1.BackgroundTransparency = (1-(0.05*i))
			Holder.Question3.Answer1.TextTransparency = (1-(0.05*i))
			Holder.Question3.Answer2.BackgroundTransparency = (1-(0.05*i))
			Holder.Question3.Answer2.TextTransparency = (1-(0.05*i))
			Holder.Question3.Answer3.BackgroundTransparency = (1-(0.05*i))
			Holder.Question3.Answer3.TextTransparency = (1-(0.05*i))
			Holder.Question3.Answer4.BackgroundTransparency = (1-(0.05*i))
			Holder.Question3.Answer4.TextTransparency = (1-(0.05*i))
			Holder.Question3.Question.TextTransparency = (1-(0.05*i))
		end
	end
	local function fadein3()
		Holder.Question3.Answer1.Active = false
		Holder.Question3.Answer2.Active = false
		Holder.Question3.Answer3.Active = false
		Holder.Question3.Answer4.Active = false
		Holder.Question4.Answer1.Active = true
		Holder.Question4.Answer2.Active = true
		Holder.Question4.Answer3.Active = true
		Holder.Question4.Answer4.Active = true
		for i = 1,25 do
			wait()
			Holder.Question4.BackgroundTransparency = (1-(0.05*i))
			Holder.Question4.Answer1.BackgroundTransparency = (1-(0.05*i))
			Holder.Question4.Answer1.TextTransparency = (1-(0.05*i))
			Holder.Question4.Answer2.BackgroundTransparency = (1-(0.05*i))
			Holder.Question4.Answer2.TextTransparency = (1-(0.05*i))
			Holder.Question4.Answer3.BackgroundTransparency = (1-(0.05*i))
			Holder.Question4.Answer3.TextTransparency = (1-(0.05*i))
			Holder.Question4.Answer4.BackgroundTransparency = (1-(0.05*i))
			Holder.Question4.Answer4.TextTransparency = (1-(0.05*i))
			Holder.Question4.Question.TextTransparency = (1-(0.05*i))
		end
	end
	---------------------------------
	Holder.Question1.Answer1.MouseButton1Click:Connect(function()
		Holder.Question1.Visible = false
		CorrectAnswers.Value += 1
		fadein1()
	end)
	Holder.Question1.Answer2.MouseButton1Click:Connect(function()
		Holder.Question1.Visible = false
		fadein1()
	end)
	Holder.Question1.Answer3.MouseButton1Click:Connect(function()
		Holder.Question1.Visible = false
		fadein1()
	end)
	Holder.Question1.Answer4.MouseButton1Click:Connect(function()
		Holder.Question1.Visible = false
		fadein1()
	end)
	---------------------------------
1 Like

Hello!
The reason buttons aren’t working in your script is because TextButtons only support .Activated event in SurfaceGui’s, and not MouseButton1Click.
So instead try to use Activated event.

Holder.Question1.Answer1.Activated:Connect(function()
		Holder.Question1.Visible = false
		CorrectAnswers.Value += 1
		fadein1()
	end)
1 Like

Haha had this exactly problem when I was making SurfaceGUI, so basically it has to be a parent of startergui for it to be interactable, and then youll want to see the Adornee of it to the part that’s in workspace

image

image

1 Like

Thanks, though, it still didn’t help. I’m not really sure what’s causing this.

Thank you, but it still didn’t help.

I have realized that the print “QUIZ WAS FINISHED” gets outprint even if I click the Question1 (first Frame) buttons. Though, it’s supposed to outprint on Question4 (fourth, last Frame).

I think it might have something to do with this. Any idea how I could disable the other buttons from being able to be clicked? They’re basically not visible because of their transparency being 1, so I’m really confused.