Unable to assign string to Text label, but it prints perfectly fine

Hey, I’m having a bit of an issue trying to set this text label’s Text property and I’m not sure where I’m going wrong.

Here is my code:

CreateOrderFrame.SelectButton.Activated:Connect(function()
	local TextToSet = GetPlayerFromPartialName(TextBox.Text)
	print(TextToSet)
	PlayerNameLabel.Text = TextToSet.Name
end)

The function GetPlayerFromPartialName looks like this:

local function GetPlayerFromPartialName(String)
	for _, Player in ipairs(Players:GetPlayers()) do
		if Player.Name:lower():find("^"..String:lower()) then
			return Player
		end
	end
end

As said in the title, it will print the text perfectly fine but it doesn’t set to the text box and there are also no errors or anything in the output. Really stumped on this one!

You need to set the text to the TextBox.Text property.
Right now you are just printing TextToSet and not actually updating the TextBox’s Text.

CreateOrderFrame.SelectButton.Activated:Connect(function()
	local TextToSet = GetPlayerFromPartialName(TextBox.Text)
	TextBox.Text = TextToSet.Name
	PlayerNameLabel.Text = TextToSet.Name
end)

Sorry, my mistake - I didn’t make my post clear at all! Its the PlayerNameLabel that won’t set. The text box doesn’t need changing

I’m trying to set the label to the the full users name (after running the partial one inputted via the text box through my GetPlayerFromPartialName function)

I see, could you show us your explorer hierarchy and a video? (if possible)