Not quite, but you're on the right track. :)
Before we begin to start fixing your code, let's review the problems w/ it:
You set the code up to change the text in the StarterGui service; the StarterGui only clones the GUIs & sets the parent property to the player's PlayerGui, it doesn't replicate the GUI to the player's screen - that's the PlayerGui's job - so w/ your current code, when a player joins, they'll get a specific text, instead of seeing all of them. (This is a common mistake w/ beginners btw, so don't feel down b/c of it. :) )
You set up an End, but there's no loop or function anywhere w/in the code you presented; if this is a snippet (not the whole code), could you provide the rest please? :)
The Text property isn't a function; you have to set the property to a text by doing "GUI.Text = [String]"
(4.) - Something I like to do, rather than using a wait like you're using it your code, is to set the amount of time depending on how many characters there're.
Now, let's begin:
First off, let's create a variable so that you don't have to keep re-typing the same line over-and-over again, which will become tedious & repetitive fast:
local TextBoxForPlayer = game.Players.LocalPlayer.ScreenGui.TextLabel
Second, lets use the WaitForChild function for the ScreenGui & TextLabel; the WaitForChild function yields the code until a child w/ the same name as the argument becomes existent w/in the specific parent, then return it; why I say lets use this, is b/c if the ScreenGui or TextLabel wasn't existent at the time of execution, your script would break! :O
Now, let's apply it:
local TextBoxForPlayer = game.Players.LocalPlayer:WaitForChild('ScreenGui'):WaitForChild('TextLabel')
Third, since it appears you want the text to change every 3-10 seconds, & change the text before that, let's use a Function in this case (I liked to do this, b/c it doesn't take too long to code, and makes it look cleaner ^^):
function changeTextAndWaitTime(textToLabel, timeOption)
TextBoxForPlayer.Text = textToLabel
wait(timeOption or textToLabel:len() / 35 + 2.5)
end
Looks much better than it did before already, huh..? :D No? Ok... ;-;
Fourth, now that we have our function, changeTextAndWaitTime, we can now begin to apply it to your code; the first argument of the function is what the TextLabel will show, while the second is optional, but if used it will use the given number & use it as the wait time; as stated previously, the wait function will yield the code for a specific amount of time (in seconds):
local TextBoxForPlayer = game.Players.LocalPlayer:WaitForChild('ScreenGui'):WaitForChild('TextLabel')
function changeTextAndWaitTime(textToLabel, timeOption)
TextBoxForPlayer.Text = textToLabel
wait(timeOption or textToLabel:len() / 35 + 2.5)
end
changeTextAndWaitTime('Hello...')
changeTextAndWaitTime('I like cheese with my nachos...')
changeTextAndWaitTime('...Do you, too?')
And, wah-lah! The end result! Play FFVII Victory Theme Here Now, when fired, it'll show the text to the player! :D
Now, I'm going to stop right here, b/c I feel (& hope) that I've set you in the right path & direction. :)
To note, I didn't add your original texts in, b/c that's your job, and not mine here; otherwise, it'd feel like I did all the work, and just gave you the script; if it were me in this case, I wouldn't feel very proud of that fact, the fact that someone gave me a script, but I didn't do anything more w/ it since someone did it for me: I'd feel HORRIBLE if that were the case w/ me. ;-;
Stuff touched on but didn't go into great detal about
StarterGui
PlayerGui
End - Ends a chunk or function, signifying when the code starts & ends.
Strings(/ Texts)
Tabbing/ Indenturing Code
Functions
WaitForChild
Wait (Function)
Hope this helped you in any way. :)
4 comments
Changing this inside of startergui wont update the players visual experience. Make this a localscript, put it inside the GUI and change it to script.Parent.TextLabel.Text = "Text"
Since you're new, i suggest to look at http://wiki.roblox.com/index.php?title=Intro_to_Scripting
Thanks everyone :) , I'm new (very new)
yeah there's quite a bit wrong here lol