I'm quite new to scripting and I'm having some difficulties. I'm trying to make a GUI pop up for whenever a certain player joins the game. Kind of like a message just for them. Just for the one player. Nobody else. I also need a button that will close the GUI when they're done reading. Can anybody give me some pointers on how to do this?
game.Players.PlayerAdded:Connect(function(plr) if plr.Name == "CertainName" then local gui = plr.PlayerGui.CertainGui.Frame gui.Visible = true --Or you could tween the gui here if you wanted to end end)
This is a local script btw
--This script is for the button, place the button in the frame and this script inside it as a local script local button = script.Parent local gui = script.Parent.Parent button.MouseButton1Click:Connect(function() gui.Visible = false --//Tweening here if wanted end)
You will need to use the PlayerAdded
event just as the following.
Make sure you make it a ServerScript (Normal).
local Players = game:GetService("Players") -- Gets the service Players. local specificPlayer = "" -- Put the username inside the quotes. local function onPlayerAdded(player) if player.Name == specificPlayer then -- Checking if the player's name is equal to the specificPlayer variable local gui = script:WaitForChild("ScreenGui"):Clone() -- Clones the gui (Assuming you'd put the gui inside the script) gui.Parent = player:WaitForChild("PlayerGui") -- Sets the gui's parent to the player's PlayerGui end end Players.PlayerAdded:Connect(onPlayerAdded) -- Connects the event to the function