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

Not being able to change text of a text label, button, box with script, Can someone help me?

Asked by 5 years ago

Hello, I'm trying to make things with a GUI and it is not letting me change the text with a script. I made a little button that makes the text change when clicked and it should change, but it does not.

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Text = "hello"
end)

Any help would be greatly appreciated!!!

1
Make it a LocalScript instead of a normal Script fr2013 88 — 5y
0
LocalScript is unnecessary DeceptiveCaster 3761 — 5y
0
wrong ^ User#24403 69 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago

Use a local script instead of a script. Scripts run on the server while local scripts run on the client. If you're using a local script, ensure the script is not disabled.

0
regular scripts can also access the PlayerGui, not just local scripts DeceptiveCaster 3761 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
script.Parent.MouseButton1Click:Connect(function()
    for _,p in pairs(game.Players:GetPlayers()) do
        p.PlayerGui.ScreenGui.TextButton.Text = "hello"
    end
end)

You don't need a LocalScript to accomplish this.

0
yes you do lol, and you should be, but your script is wrong User#24403 69 — 5y
0
it is not wrong DeceptiveCaster 3761 — 5y
0
a server script can access the PlayerGui through this exact kind of script DeceptiveCaster 3761 — 5y
0
but, i see your point: if FilteringEnabled is on, the PlayerGui cannot be accessed. DeceptiveCaster 3761 — 5y

Answer this question