Attempt to index string with ‘Text’

TextBox.Text = "r"

I cannot ssee a single thing wrong with the code. TextBox is a textLabel so i dont understand why it cant assign the text like what???

Could you send the full code here?


local TextBox = script.Parent

local EndPosition = UDim2.new(0, -3000, 0, 0)
local BeginPosition = UDim2.new(0, 0, 0, 0)

--Middle Position is X: 0,-1500. This is for refeerence only. This is to check for the text properties

local TweenService = game:GetService("TweenService")

local TextToDisplay = script.Parent.TextToDisplay

TextBox.Position = BeginPosition

TextBox = ""

local startTween = nil

while true do
	wait()
	if TextToDisplay.Value ~= "" then
		-------------------------------TWEEN

		startTween = TweenService:Create(
			------------------MOVING ITEM
			TextBox,
			------------------TWEEN INFO
			TweenInfo.new(
				6, --Seconds(Speed)
				Enum.EasingStyle.Linear, --Easing style
				Enum.EasingDirection.In,
				0, --Repeat
				false, --Reversed
				0
			),
			------------------TARGET
			{
				Position = EndPosition;

			})



		TextBox.Text = TextToDisplay.Value


		-------------------------------
		startTween:Play()
		startTween.Completed:Wait()

		TextBox.Position = BeginPosition
	else
		
		TextBox.Text = TextToDisplay.Value

	end
end

here, im stil quite new to lua coding, sorry if i overlook the mistake

do TextBox.Text = "" that was the problem lol

2 Likes

Your problem is here, you forgot to add .Text

1 Like

Thank you so much , didnt realized that i forgot to type .text, tysm

1 Like

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