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

How should I change a TextLabel's text through a script?

Asked by 2 years ago
Edited 2 years ago

In a local script I tried to use something like:

ChangeGui.OnClientEvent:Connect(function(gui, frame, label, text)
    PlayerGui[gui][frame][label].Text = text
end)

then in another script in serverscriptservice to start the GUI change:

local invon = game.StarterGui.Back.On

if invon == 1 then
    ChangeGui:FireAllClients("Back", "LevelFrame", "LevelText", "Changing")
end

Does anyone know why this isn't working?

1 answer

Log in to vote
0
Answered by 2 years ago

With your script, you are only editing the StarterGui. This is the folder that replicates your own GUIs and parents them to the player for them to see it. The problem is that editing StarterGui with a script won't affect the PlayerGui, so you should edit your script and find some way to read "invon" to continue your script.

Ad

Answer this question