Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My Script should change the text in my TextButton, but it isn't, Can I have help?

I don't know what I am doing wrong...

I'm trying to change the text in my TextButton but it wont change with this script, can I have some help?

wait(0.5)
game.StarterGui.ScreenGui.TextButton.Text = ("io")

2 answers

✓ Accepted answer

Once the game starts, anything in StarterGui that gets modified will not change for players already in the game. To do this you either have to make a LocalScript inside of the object you want to change the text of and do a script as is

-- Local Script
wait(.5)
script.Parent.Text = "io"

Another way to do this for when a player joins would be like this

-- Server Script
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(Player)
	wait(.5)
	Player.PlayerGui.ScreenGui.TextButton.Text = "io"
end)

The reason why is that StarterGuis is basically a service that clones children within it to the PlayerGui of the player.

local TextButton = script.Parent.TextButton

wait(.5)
TextButton.Text = "io"

The code above is a local script that is inside of a ScreenGui. We get the textbutton and wait 0.5 seconds and then change the text to "io"

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