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

How to make a gui appear upon player joining the server

I need to know how to script something where when a player enters the game they get a certain GUI that appears in front of them and closes after they said okay. It won't show up again if the player dies.

2 answers

✓ Accepted answer

Put a script in the button gui that you want to close the gui when clicked and put this code in it:

local gui = script.Parent.Parent --the gui to be removed, screengui
local button = script.Parent --the button (gui.button) textbutton/imagebutton

button.MouseButton1Down:connect(function()
	gui:Destroy()
end)

To make the gui visible when the player joins and only when the player joins, put the gui in game.Lighting and put the following code in a script in workspace,

local gui = game.Lighting.MyGui -- the name of your gui

game.Players.PlayerAdded:connect(function(player)
	player:WaitForChild("PlayerGui")
	gui:Clone().Parent = player.PlayerGui
end)

good luck

6 comments

0

First script works for some reason the 2nd on doesn't

0

Did you edit this line (1)? local gui = game.Lighting.MyGui

0

Yes it refused to work. Ill post the output on the next comment.

0

Oh, that's because the PlayerGui doesn't load instantly, try it now.

0

Thank you so much! It works now also if you know any person who can make gun weapons for the group I belong could you let me know?

Try something with this event

local firstJoin = false --Checks for condition

game.Players.PlayerAdded:connect(function(player)
	if firstJoin == false then
		firstJoin = true --Sets condition to opposite of what the 'if' statement is looking for.
		--GUI code here
		end
end)

There! Should probably work. Right off the top of my head though.

2 comments

0

You don't need a bool to check whether the player has joined the game already or not since the PlayerAdded event only fires once (when the player first joins)

0

Oh. Sorry, I was really tired when I posted that.

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