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

how would i create a welcome screen to appear ONLY FOR THE PLAYER THAT ENTERS?

how would i create a welcome screen to appear ONLY FOR THE PLAYER THAT ENTERS AND NOT FOR OTHERS THAT HAVE ALREADY ENTERED? I created a welcome screen, but I think it only appears once when someone enters and then does not appear for the other players. The script is located in the starterGui.TextLabel (is that why? I should leave the script in serverscriptService? if so, why? I wanted a welcome message to appear, just that script:

local butao = game.Workspace.teleportbuttom
function clicartexto ()
local texto = 'O jogo começará em '

for i = 1,#texto do
script.Parent.Text = string.sub(texto,1,i)

wait(0.1)

local cor = coroutine.wrap(function()
	local sound = Instance.new("Sound")
	sound.Volume = 1.6
	sound.SoundId = 'rbxassetid://151715959'
	sound.Parent = script.Parent.Parent
	sound:Play()
	sound.Ended:Wait()
	sound:Destroy()
end)
cor()
end
	
end
butao.ClickDetector.MouseClick:connect(clicartexto)

2 answers

✓ Accepted answer

You need to make a LocalScript, and only appears in the player's PlayerGui. PlayerGui is a GUI that only shows on the players, but not others.

Enter a script in the workspace, and paste this inside:

function added(player)	-- if a player was joined/added
	
	local GUI = script.IntroGui:clone()
	GUI.Parent = player:WaitForChild("PlayerGui")

end
game.Players.PlayerAdded:connect(added)

Now, when you are copied this inside, make the welcome screen parent to the script.

BUT, it does not appear if you click it. The welcome screen will automatically clone for the people who just joined.

If you have more suggestion, like make it appears when people click on a specific button, ask me, I'll try my best to do it, thanks!

Edit:

I'll explain how this script works.

function added(player) -- function
	
	local GUI = script.IntroGui:clone() -- this clones the IntroGui
	GUI.Parent = player:WaitForChild("PlayerGui") -- Clones the Gui to the PlayerGui

end
game.Players.PlayerAdded:connect(added) -- fire the function when a player was added

Remember, this needs a LocalScript, a LocalScript might able to use the PlayerGui, script doesn't.

2 comments

0

oh of course… sorry to ask but could you explain the script you created? i didn't understand the part about 'introgui: clone' and why you put player in the parentheses of the function (function added ('player') .Could you please explain to me?

0

Ok, I'll do some edits there.

To explain your confusion to the accepted answer. You can call functions in different ways. The accepted answer uses function [function name] and calls the function name at the end. You, however, use :connect(function() in other words you can word out the accepted answer like this:

game.Players.PlayerAdded:connect(function(player) --When a player is added it gets the player
	local GUI = script.IntroGui:Clone() -- This clones the Intro gui but it has no parent
	GUI.Parent =  player:WaitForChild('PlayerGui') -- This gives the cloned gui a parent, the player gui.
end)

I hope this explanation helps you out!

2 comments

0

ah,então quer dizer que 'player' nos parenteses de function significa é o nome da função? Boa explicação cara,valeu só tive outr

0

my bad,bro, I forgot to ask the question in English .. ah, so does that mean that 'player' in the parentheses of function means is the name of the function? Good explanation man, thanks I only had anotherheses of function means is the name of the function? Good explanation man, thanks I only had another

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