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

How do I change a StarterGui text using a server script in ServerScriptService?

Asked by 6 years ago

I'm really confused and I am very clueless as to how to do it.

So what I want is to be able to change a text using a server script, with the script being in ServerScriptService.

2 answers

Log in to vote
1
Answered by
xAtom_ik 574 Moderation Voter
6 years ago
Edited 6 years ago

ServerScriptService does not change anything, it just makes it inaccessible from local scripts for secure storage.

Approach

(change ROBLOX to the player)

game.Players.ROBLOX.PlayerGui.ScreenGui.TextLabel.Text = "Hello"

Or use:

game.Players["ROBLOX"].PlayerGui.ScreenGui.TextLabel.Text = "Hello"

Or:

game.Players:FindFirstChild("ROBLOX").PlayerGui.ScreenGui.TextLabel.Text = "Hello"

To loop through all players, use this:

for _,v in pairs(game.Players:GetChildren()) do
    v.PlayerGui.ScreenGui.TextLabel.Text = "Hello"
end

(asked in comment)

Thanks

Thanks for reading, hope it helped!

0
How would I change the text of every player? GIassWindows 141 — 6y
0
Do a for loop through every single player, running that code. Use 'v' as the player. Look here: https://scriptinghelpers.org/questions/8097/all-players-in-game-loop xAtom_ik 574 — 6y
0
Thanks dude! GIassWindows 141 — 6y
0
No problem. xAtom_ik 574 — 6y
Ad
Log in to vote
-1
Answered by 6 years ago

This Is Better To Do:

Game.Startergui.(ScreenGuiName).(Frame Name).(TextName).Text = "Text"
wait (4) 

repeat

0
That will not update for players. That will update when somebody respawns or joins however. xAtom_ik 574 — 6y
0
And that is not how to use repeat. xAtom_ik 574 — 6y

Answer this question