Code slightly skipping over or missing a part of it,

Hey developers!

I am having a slight issue where my code is not following what I wrote,

What is meant to happen?

When the script gets fired from a remote event, it should follow this code;

	print(Question)
	local NewQuestion =	script.QuestionTemp:Clone()
	NewQuestion.Parent = script.Questions
	NewQuestion.Value = Question
	NewQuestion.Name = script.QuestionNumber.Value
	script.QuestionNumber.Value = script.QuestionNumber.Value + 1
	
	if QuestionListCardsNumb == script.NumberOfQuestions.Value then
		local QuestionValues = script.Questions:GetChildren()
		print("Question Frame Creation started")
		for  i,v in pairs(QuestionValues) do
			if v:IsA("StringValue") then
				print("Question Frame Created")
				local TemplateClone = MainArea.QuestionTemp:Clone()
				TemplateClone.Parent  = MainArea.Questions
				TemplateClone.Name = "Question"..v.Name
				TemplateClone.Heading.Text = "Question "..v.Name..","
				TemplateClone.SubHeading.Text = v.value
			end
			
		end
		
	local Question1 = MainArea.Questions:FindFirstChild("Question1")
		Question1:TweenPosition(UDim2.new(0.5,0,0.572,0), "In", "Quart")
		
	else
		
		script.NumberOfQuestions.Value =  script.NumberOfQuestions.Value  + 1
		
	end
	
end)

It gets to the print and then stops, and doesnt follow a single thing after that. Just note it does print, but theres no error in the output.

1 Like

which print does it stop at?

print(Question)
-- or
print("Question Frame Creation started")
-- or
print("Question Frame Created")

The first print so

print(Question)

I’d be surprised if the block directly beneth it doesn’t run, and doesn’t error.

local NewQuestion =	script.QuestionTemp:Clone()
NewQuestion.Parent = script.Questions
NewQuestion.Value = Question
NewQuestion.Name = script.QuestionNumber.Value
script.QuestionNumber.Value = script.QuestionNumber.Value + 1

Are you sure QuestionNumber isn’t incrementing, and/or there isn’t a new child? can you add another print statement below this to make sure?

If it is running then I’m sure it’s just that your if statement is not evaluating to true. Though I do not know where QuestionListCardsNumb is coming from or what it’s value is so I cannot help without it’s definition.

1 Like

QuestionListCardsNumb Comes from a number I got from this website called trello, let me see if I can print that to check its not returning as 0.

Yep its returning as 3, which should be happening.

does print(script.QuestionNumber.Value) show 3 as well? or should your comparison be greater than instead of equal to.

if QuestionListCardsNumb >= script.NumberOfQuestions.Value then

Oh my I have been so stupid I missed out a capital letter, I am so incredibly sorry for wasting your time.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.