I’m currently making a quiz game, and I was scripting the buttons to work. However, I found it doesn’t work. Not because the script is wrong or anything (hopefully), but because the textbutton – at least visually – doesn’t sink input. I’ve turned on AutoButtonColor
for the Sample button I’m using, and it doesn’t react to clicks.
Take a look:
If the video loaded, you can see and hear that I’m trying to click the button, but it doesn’t respond.
I’ve also shown you the script thats supposed to print a text when the button is activated. (nvm OBS didn’t show it) The
Activated
event is already notorious for not working sometimes, but I tried
MouseButton1Click
and got the same results.
Any suggestions?
3 Likes
Can someone please at least respond or suggest something? I don’t wanna abandon this project.
The likes are appreciated, but I sadly have no idea what to do or what did I do wrong.
Can you send the properties of the TextButtons, Explorer layout, and the scripts?
Sure thing!

local event = game.ReplicatedStorage:WaitForChild("RequestQuestion")
local gui = game.Players.LocalPlayer.PlayerGui:WaitForChild("Quiz")
local multipleChoice = gui:WaitForChild("Background"):WaitForChild("MultipleChoice")
local choices = multipleChoice:WaitForChild("Choices")
local title = multipleChoice:WaitForChild("Title")
choices:WaitForChild("Sample").MouseButton1Click:Connect(function()
print("Click!")
end)
task.wait(3)
local function ShowQuestion(question)
title.Text = question.Title
local isAnswered = false
for i, v in pairs(question.Answers) do
if not choices:FindFirstChild(v.Answer) then
local new = choices.Sample:Clone()
new.Parent = choices
new.Visible = true
new.Text = v.Answer
new.Name = v.Answer
new:SetAttribute("IsCorrect", v.correct)
new.MouseButton1Click:Connect(function()
print("No worries, it's working!") -- doesnt show
local stroke = new:FindFirstChild("UIStroke")
if stroke then
stroke.Thickness = 3
stroke.Color = new:GetAttribute("IsCorrect") == true and Color3.new(0, 1, 0) or Color3.new(1, 0, 0)
end
isAnswered = new:GetAttribute("IsCorrect") == true
end)
end
end
--repeat wait(0.5) until isAnswered == true
end
local question = event:InvokeServer()
ShowQuestion(question)
Hope I helped!