Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Simple Text Changing Script Not Working?

Asked by 5 years ago

I'm very confused. I happened to be messing around and ended up with a problem. Here's the situation. This simple line (line, as in singular, as in A line!) of code, won't work.

script.Parent.Text = "Hi"

This is inside a script that is inside a text label. Nothing special about it just a text label and a script. Any idea what I did wrong? I'm no pro at scripting, but I would like to think that I know more to it than this.

Hope you can help.

0
Local or regular? Meltdown81 309 — 5y
0
Use a LocalScript, also make sure that the script itself is working, it might be disabled, put `print("Works")` at the top and if you don't see that in the output, you know your script isn't running at all. theCJarmy7 1293 — 5y
0
Second adding debugs. Also make sure no other script is interferring with it. It also may just be the place. Meltdown81 309 — 5y
0
I doubt the place could have anything to do with it, but outside script interference is a definite possibility. theCJarmy7 1293 — 5y
0
It also depends what the TextLabel is on. On a SurfaceGui he should use a serverscript if it's not in the StarterGui. TiredMelon 405 — 5y

1 answer

Log in to vote
0
Answered by
Mr_Unlucky 1085 Moderation Voter
5 years ago

Local scripts are required. Another thing you can do is implement a string value into replicated storage, then inserting a local script into the label.

CODE FOR THAT:

local text = game:GetService("ReplicatedStorage").StringValue
local message = script.Parent

message.Text = text.Value
text.Changed:Connect(function()
    message.Text = text.Value
end)

Next, go to serverscriptservice and implement a script executing this:

local text = game:GetService("ReplicatedStorage").StringValue

text.Value = "Hi"

Basically, for the label, the script detects if the value of the string is changed, then changes it's text to the string's value. The ServerScriptService script changes the value of the string to "Hi". It's recommended to use this for intermissions.

Ad

Answer this question