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

How to change text labels text?

local HeightA = script.Parent.Parent.Height
script.Parent.MouseButton1Click:Connect(function()
 HeightA.Text = "98"
end)

I did many text label changing it all worked but some how this time it doesnt. It didnt show me any errors. I dont get why?

Please help! Thanks in advance!

This is a local script and is inside a text button.

4 comments

0

I don't see any issues with this. After you click the button, you sure it doesn't change the text? All looks good

0

Is this in a LocalScript?

0

For the function is it just script.Parent or is it supposed to be script.Parent.Parent?

0

This is in a text button , in a local script. It is suppose to be script.Parent.Parent

1 answer

You are trying to click a text label but really you should be clicking a text button. How I would personally go about this is making a invisible text button right on top of your text label and im guessing you want the press the button once based on your example given so heres how I would do this and hopefully it helps.

local starterGui = game:GetService("StarterGui")
local textButton = starterGui.ScreenGui:WaitForChild("TextButton") --make sure the text button is in the same place as the text label and that the transpareny is set to 1 along with having no text.
local textLabel = starterGui.ScreenGui:WaitForChild("TextLabel")

clicked = false

textButton.MouseButton1Click:connect(function()
	if clicked == true then
		return
	end
	textLabel.Text = "98"
	clicked = true
end)

Again, hopefully this helped guide you in the right direction and if it did, make sure you mark the answer as solved! :)

1 comment

0

This local script is inside my text button. Sorry for the confusion.

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