Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a gui appear upon player joining the server

Asked by 10 years ago

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

Log in to vote
3
Answered by
nate890 495 Moderation Voter
10 years ago

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

0
First script works for some reason the 2nd on doesn't TheTiredHippo 30 — 10y
0
Did you edit this line (1)? local gui = game.Lighting.MyGui nate890 495 — 10y
0
Yes it refused to work. Ill post the output on the next comment. TheTiredHippo 30 — 10y
View all comments (2 more)
0
Oh, that's because the PlayerGui doesn't load instantly, try it now. nate890 495 — 10y
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? TheTiredHippo 30 — 10y
Ad
Log in to vote
-1
Answered by
OniiCh_n 410 Moderation Voter
10 years ago

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.

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) nate890 495 — 10y
0
Oh. Sorry, I was really tired when I posted that. OniiCh_n 410 — 10y

Answer this question