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 change a StarterGui text using a server script in ServerScriptService?

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

✓ Accepted answer

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!

4 comments

0

How would I change the text of every player?

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

0

Thanks dude!

0

No problem.

This Is Better To Do:

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

repeat

2 comments

0

That will not update for players. That will update when somebody respawns or joins however.

0

And that is not how to use repeat.

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