I’m trying to make a welcome screen for my game that only comes up when you join for the first time and then never comes up again. How could I make this work?
Add a datastore for the first time a player joins, get the server to check it and if it returns nil then make the tutorial show up and write data for the player.
There are 2 ways you could do, Badge and Datastore
If you have the robux you could make a badge and when the player joins, check if don’t have the badge. If they don’t have the badge, show the gui and give them the badge, if they do have it, do nothing
For datastoring, you can make it so when a player joins the game, and if they don’t have a value in the datastore that equals to true, show the gui and add a value with their userId is entered as a key in the datastore, with a value of true
connected to it. So it gets shown once
Okay I think I will use a badge since I already have one in my game. Thanks!
I’m also really bad with datastores lol
Alright! Good luck with that! It should be a relatively simple thing to set up, just set up and if statement that shows the gui fi you don’t own the badge and give the badge and if you do own the badge, do nothing
If my post has helped you, don’t forget to mark it as the solution! If you have anymore issues don’t be afraid to make another post!
I know its like simple but I’m like stuck trying to figure out how to code it I feel like the hardest part is like getting the GUI to enable for me because I don’t know how to code that. Is there any way you could help me figure out how to do it? I have a GUI called WelcomeScreen but I dont know how to enable it if the player owns a badge.
It’s simple to do so. First you need to make a variable to contain BadgeService. Once that’s done, make an event for when a player join. And use UserHasBadgeAsync
in an if statement, giving the player’s UserId and id of the badge, and if it returns true, you have the badge, so don’t do anything. If it return sfalse, then you don’t have the badge, so show the gui and award the badge. A simple way would be this
local badgeServ = game:GetService("BadgeService")
local players = game:GetService("Players")
local firstTimeBadge = --Your Badge id
players.PlayerAdded:Connect(function(plr)
local plrgui = plr:WaitForChild("PlayerGui")
if not badgeServ:UserHasBadgeAsync(plr.UserId,firstTimeBadge) then
plrgui.WelcomeGui.Enabled = true
badgeServ:AwardBadge(plr.UserId,firstTimeBadge)
end
end)
Where WelcomeGui
is the name of your first time ScreenGui. Make sure it is Disabled at first by setting the property
I put the script in server script service and tried it (out of studio) and it didnt award the badge or show anything and I made sure to delete the badge from my inventory
Did you copy it exactly and forget to write your badgeid in the firstTimeBadge line? Did you get any errors?
I put in the badge id ill check for errors one second
It says WelcomeGui is not a valid member of PlayerGui but I think that’s because the GUI is called WelcomeScreen so let me fix that and see if it works
Now it says that WelcomeScreen is not a valid member of PlayerGui
What does the StarterGui look like in the Explorer? And where is your WelcomeScreen located
What code you have as of now that I helped with?
I have this code which should award the badge and show the GUI but thats it. (its in serverscriptservice btw)
Try this out?
local badgeServ = game:GetService("BadgeService")
local players = game:GetService("Players")
local firstTimeBadge = --Your Badge id
players.PlayerAdded:Connect(function(plr)
local plrgui = plr:WaitForChild("PlayerGui")
local welcome = plrgui:WaitForChild("WelcomeScreen")
if not badgeServ:UserHasBadgeAsync(plr.UserId,firstTimeBadge) then
welcome.Enabled = true
badgeServ:AwardBadge(plr.UserId,firstTimeBadge)
end
end)
It worked! Thank you for the help!
Anytime! if you have anymore issues don’t be afraid to make another post!