Attempt To Index String with 'Text'?

So I have this little mission system Im starting to work on its going great problem is when Im trying to create a new mission and specify the Description, Objective and the Name it keeps erroring, I clone the quest ui into the players mission inventory and I replace the default text with new ones when I call the function but it isnt working.

function X:PromptQuest(questname,description, objective)
	qGiver:FireServer(questname, description)
	X:Tween(questPrompt, .25, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut, 0, false, {Position = UDim2.new(0.005, 0,0.005, 0)})
	Write.typeWrite(questtext,self)
	wait(1)
	X:Tween(questPrompt, .25, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut, 0, false, {Position = UDim2.new(0, 0,-1, 0)})
	local NewMission = MissionInfo:Clone()
	NewMission.Parent = MissionFrame
	NewMission.Visible = true
	NewMission.Name.Text = questname
	NewMission.Objective.Text = objective
	NewMission.Des = description
end
X.PromptQuest("NEW MISSION AVAILABLE!", "Pete's Hunger!","You find yourself waking up late for school and in a hurry!", "Look around the kitchen for something to eat and QUICKLY!")

image

7 Likes

I believe the issue is here.

This is because it is trying to index the .Name property of NewMission before the child.

A hacky way to fix this is to use WaitForChild or FindFirstChild.

NewMission:FindFirstChild("Name").Text = questname

Alternatively rename the Name child to something else, like “QuestName” The .Name property is a string, and so trying to index it will throw an error.

Quest.QuestName.Text = questname
29 Likes

OHHHHHH my gosh thanks man alright let me try that

1 Like

Yeah this is a pretty frustrating bug if you don’t know why it occurs. I ran into the same issue whilst naming a child Name haha

7 Likes