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

how do I make it appear only when the player enters the game?

how do I make it appear only when the player enters the game? I created a script to make a welcome text appear on the screen when the player enters the game. The problem is that every time the player dies, the message appears again when it should appear only once at the beginning of the game. Script:


wait(4)
screen = script.Parent
wait(0.1)
screen.Text = 'W'
wait(0.1)
screen.Text = 'We'
wait(0.1)
screen.Text = 'Wel'
wait(0.1)
screen.Text = 'Welc'
wait(0.1)
screen.Text = 'Welco'
wait(0.1)
screen.Text = 'Welcom'
wait(0.1)
screen.Text = 'Welcome'
wait(0.1)
screen.Text = 'Welcome '
wait(0.1)
screen.Text = 'Welcome t'
wait(0.1)
screen.Text = 'Welcome to'
wait(0.1)
screen.Text = 'Welcome to '
wait(0.1)
screen.Text = 'Welcome to L'
wait(0.1)
screen.Text = 'Welcome to La'
wait(0.1)
screen.Text = 'Welcome to Lav'
wait(0.1)
screen.Text = 'Welcome to Lava'
wait(0.1)
screen.Text = 'Welcome to Lava '
wait(0.1)
screen.Text = 'Welcome to Lava R'
wait(0.1)
screen.Text = 'Welcome to Lava 	Ru'
wait(0.1)
screen.Text = 'Welcome to Lava Run'
wait(5)
screen.Text = ''

I also wanted to know how do I detect that the player has entered the game? so that the message appears at the right time.

3 answers

✓ Accepted answer

Hello lytew, wonderful question!

Well first off I'd like to tell you that there is a lot more efficient way to do what you're trying to do while saving space in your script!

To get the type-writer effect you're trying to get you can simply do this:

local WelcomeText = "Welcome to Lava Run!" --Change this to what you desire!

for i = 1, #Text do
	screen.Text = (string.sub(Text, 1, i)) 
		wait(.01)
end

Now, moving onto how to make this only appear when the player joins the game, simple!

You can do this script [local script]!

local Players = game:GetService("Players")
local WelcomeText = "Welcome to Lava Run!" --Change this to what you desire!

Players.PlayerAdded:Connect(function() 
	for i = 1, #Text do
	screen.Text = (string.sub(Text, 1, i)) 
		wait(.01)
	end

repeat wait() until screen.Text == WelcomeText  --Runs a wait() loop until the text is done!

wait(5) 

screen.Text = ""

script:Destroy() -- This will destroy this script after the text appears!
end)

This is a lot more efficient and better, saves you time and room! If I helped you be sure to mark as the solution and Up Vote!

Happy scripting!

3 comments

0

oh, got it, man. Could you explain something to me? how do I use it and what is the 'for i = 1, #text do' for?

0

there man, help me? the script didn't work, nothing happens.

0

Sorry, what's the issue?

To make it so the GUI not appear upon reset, you have to click on the ScreenGUI and go to the properties. On the properties window, it should say ResetOnSpawn or something like that. Make srue that is false. And to detect when the player enters the game I think its

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
       --Your Code
end)

Make sure your Intro's ScreenGUI ResetOnSpawn tick box is false ( not ticked ).

Use the PlayerAdded event. To do it, write down this script:

game.Players.PlayerAdded:Connect(function(player()
wait(4)
screen = script.Parent
wait(0.1)
screen.Text = 'W'
wait(0.1)
screen.Text = 'We'
wait(0.1)
screen.Text = 'Wel'
wait(0.1)
screen.Text = 'Welc'
wait(0.1)
screen.Text = 'Welco'
wait(0.1)
screen.Text = 'Welcom'
wait(0.1)
screen.Text = 'Welcome'
wait(0.1)
screen.Text = 'Welcome '
wait(0.1)
screen.Text = 'Welcome t'
wait(0.1)
screen.Text = 'Welcome to'
wait(0.1)
screen.Text = 'Welcome to '
wait(0.1)
screen.Text = 'Welcome to L'
wait(0.1)
screen.Text = 'Welcome to La'
wait(0.1)
screen.Text = 'Welcome to Lav'
wait(0.1)
screen.Text = 'Welcome to Lava'
wait(0.1)
screen.Text = 'Welcome to Lava '
wait(0.1)
screen.Text = 'Welcome to Lava R'
wait(0.1)
screen.Text = 'Welcome to Lava  Ru'
wait(0.1)
screen.Text = 'Welcome to Lava Run'
wait(5)
screen.Text = ''
end)

Hope that helps!

1 comment

0

You did game.Players.PlayerAdded:Connect(function(player() when it should be game.Players.PlayerAdded:Connect(function(player)

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