Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is this not working? I'm trying to change the text of something!

Hello. I'm using a local script to do this in.

function ChangeText()
	local Text = script.Parent.Text
	Text = "dsadad"
end

ChangeText()

It will not do anything. Please help!

2 comments

0

What is script.Parent.Text exactly

0

Tip, when changing Properties of things, dont reference the Property you want to change inside of the Variable! Hope this helps.

1 answer

It's because your variable called Text is directly referencing the Text of your TextLabel/Button. When you go and do

Text = "dsadad"

You're actually changing the variable and not the TextLabel/Button.

function ChangeText()
	local Text = script.Parent
	Text.Text = "dsadad"
end
ChangeText()

The code above will actually change the Text of the TextLabel/Button.

This discussion is preserved as it was. New answers, comments, and votes are closed.