Hello, I have made a type writing script for my horror game. I basically want the gui that has the text type in it to disappear after it has finished the setTexts. This is because I don’t want it to get in the way of game play. Can anyone help me out please?
You could just disable the Enabled property of the ScreenGui through a script.
Ok? But I do not know the script for it. Could you help please?
My script currently looks like this:
local TextLabel = script.Parent
local Text
local Frame1 = script.Parent.Parent
function setText (word)
Text = word
for i = 1, #Text do
TextLabel.Text = string.sub(Text, 1, i)
TextLabel.TextColor3 = Color3.fromRGB(255,255,255)
wait(0.04)
end
end
wait(4)
setText(“Welcome to The Traveller’s Escape”)
wait (3)
setText(“You may be wanting to see what the purpose of this game is…”)
wait(2)
setText (“Well I am your guide and will help you along your journey. You can call me guide.”)
wait(1)
wait(string.len(“Well I am your guide and will help you along your journey. You can call me guide.”))
Frame1.Visible:Destroy()
instead of Frame.Visible:Destroy(), do Frame:Destroy(), if you want to temporarily hide it, do Frame.Visible = false
I’m pretty sure I saw this topic before, don’t double post topics. Just be patient.
and try Frame1:Destroy()
So you would do this:
local Player = game.Players.LocalPlayer
local ScreenGui = Player:WaitForChild("PlayerGui"):WaitForChild("ScreenGui") -- Create a variable for the screengui so that we can disable it later on
local TextLabel = script.Parent
local Text = TextLabel.Text
local Frame1 = script.Parent.Parent
function setText (word)
Text = word
for i = 1, #Text do
TextLabel.Text = string.sub(Text, 1, i)
TextLabel.TextColor3 = Color3.fromRGB(255,255,255)
wait(0.04)
end
end
wait(4)
setText(“Welcome to The Traveller’s Escape”)
wait (3)
setText(“You may be wanting to see what the purpose of this game is…”)
wait(2)
setText (“Well I am your guide and will help you along your journey. You can call me guide.”)
wait(1)
wait(string.len(“Well I am your guide and will help you along your journey. You can call me guide.”))
ScreenGui.Enabled = false
end
If you are trying to hide the ScreenGui and not destroy the frame just do:
ScreenGui.Enabled = false
Sorry I am kind of new to the dev forum, won’t do it again.
Well you can always insert a local script inside Frame and have a button appear after setText is done like this
script.Parent.TextButton.MouseButton1Click:Connect(function()
for loop = 1,10 do
wait(0.1)
script.Parent.TextButton.BackgroundTransparency = loop/10
-- This is for the button itself, make sure its shape is "Custom".
script.Parent.TextButton.TextTransparency = loop/10
-- This is for the text in the button.
script.Parent.BackgroundTransparency = loop/10
-- This is for the frame.
script.Parent.TextLabel.BackgroundTransparency = loop/10
game:GetService("RunService").Stepped:Wait()
if script.Parent.BackgroundTransparency == 1 then
script.Parent.Parent.Visible = false
end
end
end)
What I’ve done here is simply fade out the textlabel the button itself, hope this helps
How do I make a variable for the screen gui?
Assuming the frame is right under the ScreenGui just do
local ScreenGui = Frame.Parent
Wow, I will most likely add this thanks:D
You would want to make a variable for the player and the playergui or straight up get the playergui and then get the screengui from there:
local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local ScreenGui = PlayerGui:WaitForChild("ScreenGui")
(Also, make sure you are doing this through a local script which you are probably doing)
Make sure you are calling the right ScreenGui, you probably got a different ScreenGui. Mind, showing me the StarterGui?
Thank you!!! the only problem was that there was no end needed at the bottom of the script. I also used both of your variables to make it work. Thanks again:)
No problem, I’m glad that I’ve helped you!
No problem I am happy that I was able to help. Also, are you attempting to disable the actual GUI itself using variables, or does it relate to the frame and button pop-up? As of now, I currently have a (wait30) on my type-writer effect, not sure how I’m supposed to fix it. Maybe I can just disable the script, and when the player chooses the level/difficulty mode they want to play at, the script will be re-enabled.
I am currently just hiding it. well I am not the best scripter and do not know a lot about it which is why I mainly use the dev forum to get my questions answered. As you know I am making a horror game, I am trying to figure out how to make it so when the player goes through a part (entering a room) the type writing with the gui from before starts typing again but with a different text. So if you know how to do that, then you can go onto my topic about it which I am about to make. Thanks.