Make a welcome gui for new players?

What i want to do is make a gui that players will see the first time they play my game, however only show for people who play the game for the first time, so i want to make this work with my welcome badge, how would i do this (like through a local script)

In your datastore script, check if their data == nil, if it’s nil then prompt the user, otherwise don’t prompt the user.

2 Likes

i dont want this to work with datastores but instead with the welcome badge in my game

Ah, then check if they own the badge using :UserHasBadgeAsync(). If they own it then don’t prompt them. If they do own it, prompt them.

3 Likes

yeah but how would i make a local script check if the local player joined and see if they own the badge or not to determine if they should or should not see the welcome gui

Use remote events or you can run it in a localscript using LocalPlayer.UserId.

1 Like

but is there a way to check through a local script if the local player joined such as PlayerAdded

You can just put it in StarterPlayerScripts or StarterGui and not wrap it in a function, then it’ll execute once the player first joins.

Hi there! To do so, you can use BadgeService. Here’s an example on how you could make a welcome GUI for new players only:

Script (located in ServerScriptService)

local BadgeService = game:GetService("BadgeService")

game.Players.PlayerAdded:Connect(function(Player)  -- When a player join the game,
	if BadgeService:UserHasBadgeAsync(Player.UserId, BADGE_ID_HERE) then
		-- Player has badge, fire a RemoteEvent.
	else
		-- No badge found -> Award badge to the player.
		BadgeService:AwardBadge(Player.UserId, BADGE_ID_HERE)
	end
end)

Adding on it, you cannot check if the player has a badge using a local script (according to the official ROBLOX documentation).

I hope this may help you!

1 Like

No need to use a RemoteEvent, just use this and put what is needed in this position.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local BadgeService = game:GetService("BadgeService")

Player = game:GetService("Players").LocalPlayer
Gui = ReplicatedStorage:WaitForChild() --| ScreenGui name

local BadgeID = 0

local success, hasBadge = pcall(function()
    return BadgeService:UserHasBadgeAsync(Player.UserId, BadgeID)
end)
if success and not hasBadge then
    Gui:Clone().Parent = Player.PlayerGui
end
wait(1)
script:Destroy()

image

Your reply is pretty good, but there a few things I don’t understand.

First, why do you want to delete the script after 1 second? That’s completely unneeded.

The second thing is that you may use RemoteEvents to play animations/Tweening, etc after a special time. If you only clone the GUI object, animations/tweenings will play immediately.

1 Like

It is removed because it is no longer necessary, so there is no trash or purposeless objects.

Just put a script that will fire when ScreenGui is put into PlayerGui, since they don’t fire in ReplicatedStorage and don’t need to wait(), I recommend using WaitForChild() to avoid errors, could also use a module.

local badgeService = game:GetService('BadgeService')

local me = game.Players.LocalPlayer
local gui = path.to.gui

local _, hasBadge = pcall(function()
    return badgeService:UserHasBadgeAsync(me.UserId, badgeIdHere)
end)

if not hasBadge then
    gui:Clone().Parent = me.PlayerGui
end
script:Destroy()

This is pretty much the same as @SOTR654 s solution, but a bit shorter.

1 Like

He has a point because I already have a button that you can press to remove the gui already and doing your script would show the welcome gui with information but then just disappear after one second which i want the player to click a “Play!” Button to remove it instead