Text wont change

I am having a problem with this script:

local GUITextChange = script.Parent
local Text = GUITextChange.Text
wait(13)
Text = ("e scp")

I can’t figure out why the text wont change. Here is another script that I think could be interfering with it.

local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(
	5, --Time
	Enum.EasingStyle.Linear, --EasingStyle
	Enum.EasingDirection.Out, --EasingDirection
	0, --Repeat count
	false, --Reverses if true
	0 --Delay time
)
local tween = tweenService:Create(script.Parent, tweenInfo, {TextTransparency = 1})
tween:Play()

wait(8)

tweenInfo = TweenInfo.new(
	5, --Time
	Enum.EasingStyle.Linear, --EasingStyle
	Enum.EasingDirection.Out, --EasingDirection
	0, --Repeat count
	false, --Reverses if true
	0 --Delay time
)
tween2 = tweenService:Create(script.Parent, tweenInfo, {TextTransparency = 0})
tween2:Play()

Change Text to text for it to work
local text = GUITextChange.Text

Your problem is that you’re just reassigning a variable to another value, not changing the Text property like I’m assuming you want to.

It should look something more like this:

wait(13)
script.Parent.Text = "e scp"

Where the path to the object whose text you want to change is so short, there’s not really a problem with leaving your two variables out. Just keep in mind that when you assign a variable to a property, it just assigns it the same value as that property. It does not create a direct reference to the property itself.

1 Like

When having “Text” roblox thinks its the properties so if you want the varible to be called text, it must be all lowercase

That’s actually not true. You can have a variable named “Text” if you want. It’s not a protected or pre-defined keyword.

If you want to access the Text property of an object, you do have to be case-sensitive, but there are no such restrictions on user-defined variable names.

@334901766 No, it doesn’t. Please don’t state misinformation. When you index, it will avoid variable names. So even if you have a variable named Text, when you index it will not use the variable.

The only way to use a variable as a way to index something is to use brackets. For example:

local a = "1"

script.Parent.a -- it will not use the variable
script.Parent[a] -- it will use the variable

@OP, that is not how you set a property a new value. What you’re doing to the Text variable is setting the value of the Text property.

To change the properties, you’d do what @ChiefWildin said.

1 Like

It does? When I tried local Text when I started scripting it didnt work but local text did

image

1 Like