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

How do I use a script to change text from a text label?

I'm new to scripting and don't really know what i'm doing. I've tried to do this myself before but I couldn't. I appreciate any help! -JoyousCaribou48

3 comments

0

Please include your code even if it does not work. this shows you have made an attempt at solving your question.

0

This is what i've done so far:

0

local text = script.Parent.Text text = "Test"

3 answers

✓ Accepted answer

Well, the TextLabel object has a property called text that can be change, so what you simply have to do is :

TextLabel.Text = "Something of this sort"

Of course, it depends on where the gui is place, if the gui is placed inside the starter gui, you have to use a local script, however if it is in workspace and you want players to see it, you have to change it via a server script

A couple of other things to note:

1.) to reference things you originally put in starter gui, reference the PlayerGui instead, as all things inside the starter gui are cloned into the player gui when that player joins the game.

Ex:

local playerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")

6 comments

0

I'll give that a try!

0

But how do I use this and where? local playerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")

0

it should be in a local script as |game.Players.LocalPlayer| can only be used on the client

0

I'm sorry I don't understand i'm newish to scripting. What is the "cilent"?

0

I’ll just accept your answer thank you for the help!

0

well the clients are the players playing your game and the server is your game, thats a pretty crude way to explain it

Put This On The Button Which Should Change The Text

Target = script.parent.parent --This MayBe Wrong Cause You Have To Show 'Script' Where It Is.

Target.Text = "The Button Worked"

Textlabel.Text = "example"

you might have to change where the pathing goes for example

game.StarterGui.ScreenGui.Frame.TextLabel.Text = "example"

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