This is what I have used so for;
1 | Game.Players.PlayerAdded:connect( function (player) |
2 | player.CharacterAdded:wait() |
3 | --Show & remove GUI |
4 | end ) |
I don't know where to insert it and, I have tried using it and it doesn't work.
As CaptainRuno and Hrbric have posted, why not use the .PlayerAdded
event? The .PlayerAdded
will only fire once, it won't refire again when the Player dies. Heres how you'd do it;
01 | local Time = 5 --This is the amount of time before the Gui is removed |
02 | local GuiName = "ScreenGui" --This is where the Name of the Gui will be [You can change this to the name of your Gui] |
03 | local function PlayerSpawn(plr) --This is our function; when the player joins, this function will be fired; the player that has joined will be defined as 'plr' |
04 | if game:GetService( "Lighting" ) and game.Lighting:FindFirstChild(GuiName) then --You don't have to use '.Lighting', you could use another Service like 'ReplicatedStorage', this will check to see if the script gets the service of '.Lighting', and finds the Gui within '.Lighting' |
05 | repeat wait() until plr:FindFirstChild( "PlayerGui" ) --I like to use the 'repeat until nil' loop to wait until it finds/gets all the requirements |
06 | local Gui = game.Lighting:FindFirstChild(GuiName):Clone() --This defines the Gui, and Clones it |
07 | Gui.Parent = plr.PlayerGui --Sets the Gui's Parent to the Player's PlayerGui; PlayerGui/Screen |
08 | wait(Time) --This is the amount of time before the Gui is removed |
09 | Gui:Destroy() --This will destroy the Gui |
10 | end --This ends the 'if' code statement |
11 | end --This ends the 'function' code statement |
12 |
13 | game.Players.PlayerAdded:connect(PlayerSpawn) --Now, when a Player joins, it will fire the event/function |
Hope this helped!
Remove the character added, that fires when the character resets or spawns again.
1 | Game.Players.PlayerAdded:connect( function (player) |
2 | --Show & remove GUI |
3 | end ) |
Instructions:
1. Make the GUI named, "BRUH" **
**2. Put it in Lighting
1 | game.Players.PlayerAdded:connect( function (player) |
2 | local HowLongYouWantTheGuiToRemove = 10 -- time to remove gui |
3 | local x = game.Lighting.BRUH:Clone() |
4 | x.Parent = player.PlayerGui |
5 | wait(HowLongYouWantTheGuiToRemove) |
6 | x:remove() |
7 | end ) |