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?
1 | wait( 0.5 ) |
2 | game.StarterGui.ScreenGui.TextButton.Text = ( "io" ) |
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
1 | -- Local Script |
2 | wait(. 5 ) |
3 | script.Parent.Text = "io" |
Another way to do this for when a player joins would be like this
1 | -- Server Script |
2 | local Players = game:GetService( "Players" ) |
3 |
4 | Players.PlayerAdded:Connect( function (Player) |
5 | wait(. 5 ) |
6 | Player.PlayerGui.ScreenGui.TextButton.Text = "io" |
7 | end ) |
The reason why is that StarterGuis is basically a service that clones children within it to the PlayerGui of the player.
1 | local TextButton = script.Parent.TextButton |
2 |
3 | wait(. 5 ) |
4 | 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"