A quick update to the situation.
I added this code to print the parent of NextButton.
while wait(1) do
print(NextButton.Parent)
end
The correct parent is Question Template
. It printed Question Template
until I hit the “Ready” button.
The parent is not nil, because I went into PlayerGui and took this screenshot.
So there is something stopping my code.
Do you guys have any ideas on what is stopping my code?
local PlayerGui = game.Players.LocalPlayer.PlayerGui
local TransparentLayer = PlayerGui:WaitForChild("Application")["Base"]["Transparent Layer"]
local IntroductionTemplate = TransparentLayer["Introduction Template"]
local ReadyButton = IntroductionTemplate:FindFirstChild("ReadyButton")
local NextButton = TransparentLayer["Question Template"]["NextButton"]
IntroductionTemplate.Visible = true
local SavedAnswers = {}
local TimeLimit = 300
local NotedTimeLimit = 300
local function BaseFunction(QuestionNum, Question)
local QuestionString = "Q"..QuestionNum..". "..Question
local QuestionTemplate = TransparentLayer["Question Template"]
if IntroductionTemplate then
local HidingPos = UDim2.new(2,0,0,0)
local TargetPos = UDim2.new(0.012,0,0,0)
IntroductionTemplate:TweenPosition(HidingPos, "Out", "Quint", 1)
repeat wait() until IntroductionTemplate.Position == HidingPos
IntroductionTemplate:Destroy()
local QuestionBox = QuestionTemplate.QuestionBox
QuestionBox.Text = QuestionString
QuestionTemplate.Visible = true
QuestionTemplate:TweenPosition(TargetPos, "Out", "Quint", 1)
return
end
if TransparentLayer:FindFirstChild("Question Template") then
local Question = TransparentLayer:FindFirstChild("Question Template")
local HidingPos = UDim2.new(2,0,0,0)
local TargetPos = UDim2.new(0.012,0,0,0)
Question:TweenPosition(HidingPos, "Out", "Quint", 1)
repeat wait() until Question.Position == HidingPos
local QuestionBox = Question.QuestionBox
QuestionBox.Text = QuestionString
Question.Visible = true
Question:TweenPosition(TargetPos, "Out", "Quint", 1)
end
end
function sendTrelloResults()
end
if TransparentLayer:FindFirstChild("Introduction Template") then
local IntroductionTemplate = TransparentLayer:FindFirstChild("Introduction Template")
local ReadyButton = IntroductionTemplate:FindFirstChild("ReadyButton")
ReadyButton.MouseButton1Click:Connect(function()
BaseFunction("1", "If you were to greet a customer at the cafe, what would be your greeting?")
end)
end
while wait(1) do
print(NextButton.Parent)
end
NextButton.MouseButton1Click:Connect(function()
print("got to the clicked function")
local Times = 0
if Times == 0 then
Times = Times + 1
BaseFunction("2", "Why do you choose to work at Reiné over other companies?")
elseif Times == 1 then
Times = Times + 1
BaseFunction("3", "Why do you feel like you should be accepted over other applicants & what special abilities do you possess?")
elseif Times == 2 then
Times = Times + 1
BaseFunction("4", 'Correct this sentence: Hay welcome to rénay cafwe. Im gladd too be takinq youre ordier todeay howw may i helpp!')
end
end)