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)
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.
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!