How do you make a “You Met The Creator” Badge? I’m just curious and probably will add that in my game.
local BadgeService = game:GetService(“BadgeService”)
local BadgeId = put ur badge ID
local CreatorName = “CREATORNAMEHERE”
game.Players.PlayerAdded:Connect(function()
if game.Players:FindFirstChild(CreatorName) then
local Players = game.Players:GetPlayers()
for i = 1, #Players do
local Player = Players[i]
if not BadgeService:UserHasBadgeAsync(Player.UserId, BadgeId) then
BadgeService:AwardBadge(Player.UserId, BadgeId)
end
end
end
end)
using this script put in serverscriptstorage
thanks! i will test it out later with my friend.
Instead of CREATORNAME, I think ID would be more accurate.
Okay, i will test it out later.
maybe but both can be used because id and username gives the same result.
Well, the problem is, username everyone can copy, while ID cannot be. For example:
User1(owner of game): MystiqueArts
User2(player): MystiqueArtsIsCool
So, if name was only put, when User2 joins, everyone still gets the badge, just because the username is almost similar.
oh because i used this i got no problem like that because my friend has the same username as mine but still ok thank you.
Don’t use username’s you can change it and all of a sudden your Badge you met the owner script will break.
(Also, you shouldn’t paste the whole script as it is better to learn by directing the user to the correct path instead of just giving them the script at whole)
What?
"MystiqueArts" ~= "MystiqueArtsIsCool"
Poor example. There is no way that everyone will get badge if the user2 joins, except if you try to find a string like so: if plr.Name:find(CreatorName)
then
But you should still be using UserId’s for things like that, because whenever the owner changes their username the script will no longer work.
@pranavspiderman1
game.Players.PlayerAdded:Connect(function()
if game.Players:FindFirstChild(CreatorName) then
Just… why… PlayerAdded
already passes the player argument for you, so no need to use FindFirstChild here, but instead check if the player’s name is equal to the game creator’s name:
game.Players.PlayerAdded:Connect(function(plr) -- plr is the player who joined
if plr.Name == CreatorName then -- you should still be checking for the userid