How would I make a tutorial gui that has next/back?
if I said
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Text = Text1
end)
How would I make it so it moves the text to Text2 when I click ‘Next’?
How would I make a tutorial gui that has next/back?
if I said
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Text = Text1
end)
How would I make it so it moves the text to Text2 when I click ‘Next’?
You can create a table of different strings, and then grab one of those strings in accordance to the tutorial slide you are on.
For example:
TextTable = {"blah blah 1","blah blah 2","blah blah 3"}
TutorialStep = 1
script.Parent.Text = TextTable[TutorialStep]
script.Parent.MouseButton1Click:Connect(function()
TutorialStep = TutorialStep + 1
script.Parent.Text = TextTable[TutorialStep]
end)
There are many methods to accomplishing this, but this is a great way to go about it, because you can keep all your messages all in one compact table.
Hello, I just have one more issue. When I close it then re-open it up it will not let me press next because its still on the last frame. How do I make it so when I close it and then re-open it the text says blah blah 1?
Edit: If you want video to explain it more please ask me
You just need to reset TutorialStep to 1, then reset the TextLabel’s “Text”.
--run this when you re-open your GUI
TutorialStep = 1
script.Parent.Text = TextTable[TutorialStep]
But the thing that makes it change text and the thing that opens the GUI are in different scripts.
What should I do about this?
(30 char)
You have a few options here. You could either, combine them scripts into one, or just set the text in your TextLabel manually from the GUI open script, like so:
-- run this from the GUI open script
script.Parent.Parent.Next.Text = "blah blah 1"
Like so? (Open script)
script.Parent.MouseButton1Down:Connect(function()
script.Parent.Parent.TutorialFrame.TutorialText.Text = "Hello, welcome to Vaccine Simulator!"
script.Parent.Parent.TutorialFrame.Visible = true
end)
Something is wrong:
Based on the genealogy you showed me, you would need to use script.Parent.Parent.Next.TutorialNext.Text, instead of script.Parent.Parent.TutorialFrame.TutorialText.Text to access the Text inside TutorialText.
My issue here is: How would I access the variable ‘tutorialstep’ from another script?
For instance:
Saying TutorialStep = 1 In another script wouldn’t work because it will not recognise the variable.
You could define TutorialStep as a Global variable. What is _G and for what i can use it? - #6 by jaschutte
I tried that so I put this is the next script
_G.TutorialStep = 1
and now nothing works. I cannot even change the text. So in the 2nd script I put:
–under the open script
_G.TutorialStep = 1
Are you editing he contents of the variable through _G? You need to also prefix TutorialStep by _G. even after it is defined.
Here are the two scripts:
open script:
script.Parent.MouseButton1Down:Connect(function()
_G.TutorialStep = 1
script.Parent.Parent.TutorialFrame.TutorialText.Text = "Hello, welcome to Vaccine Simulator!"
script.Parent.Parent.TutorialFrame.Visible = true
end)
next script:
TextTable = {"Buy vaccines then sell them to get money and stop the virus","Depending on the virus, it afffects how bad the infections are","Then, use your money to buy more, and better vaccines.","Make sure to like, favourite and share this game with your friends! Good luck on saving the earth."}
_G.TutorialStep = 1
script.Parent.Parent.TutorialText.Text = TextTable[TutorialStep]
script.Parent.MouseButton1Click:Connect(function()
TutorialStep = TutorialStep + 1
script.Parent.Parent.TutorialText.Text = TextTable[TutorialStep]
end)
Is there anything wrong with these scripts? If not, why are they not working?
Make sure to access TutorialStep from _G the second time, as well as the first.
_G.TutorialStep = _G.TutorialStep + 1
So I put this is the first script, second or both?
edit: I put it in both now absolutely nothing works
Any errors? Can I see your code now?