Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My Premium Nametag doesn't work?

Hi, my premium nametag dont work I don't know why here is the script :

local id = 1082986441
local billboardgui = script:WaitForChild("BillboardGui")
 
game.Players.PlayerAdded:connect(function(player)
    if game:GetService("GamePassService"):PlayerHasPass(player, id) then 
      local b = billboardgui:Clone()
b.Parent = game:GetService("Players").LocalPlayer.Character
    else
        print(player.Name .. " doesn't have the game pass...")
    end
end)

with a billboardgui inside of the script but ingame it's doesn't show the * PREMIUM * :( Thanks for the help.

1 comment

0

This will only show for the local player, you should test this on a normal script 

4 answers

Hi! PlayerHasPass is no longer supported by ROBLOX, use UserOwnsGamePassAsync instead, same with MarketplaceService, rather than GamepassService. player is also no longer a valid parameter, use player.UserId instead.

Your script should be:

local id = 1082986441
local billboardgui = script:WaitForChild("BillboardGui")

game.Players.PlayerAdded:connect(function(player)
    if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, id) then 
      local b = billboardgui:Clone()
b.Parent = game:GetService("Players").LocalPlayer.Character
    else
        print(player.Name .. " doesn't have the game pass...")
    end
end)

Hope this works!

1 comment

0

doesn't work

###The PlayerHasPass method is broken because of the new game pass updates. As previously mentioned, MarketplaceService:UserOwnsGamePassAsync() should be used instead. Another problem is you were using LocalPlayer from a server script, which LocalPlayer is nil on. Since you were using PlayerAdded, use its parameter instead.

wait()
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local id = 1082986441
local billboardgui = script.BillboardGui

local function hasPass(plr)
    return MarketplaceService:UserOwnsGamePassAsync(plr.UserId, id)
    -- return true if they have the id, return false if not 
end

game.Players.PlayerAdded:Connect(function(player) -- :connect is deprecated, use :Connect. also, this is the player, use this and not LocalPlayer
    player.CharacterAdded:Connect(function(character) -- wait for character! 
        if hasPass(player) then -- if they have the pass
            local b = billboardgui:Clone()
            b.Parent = character
        else
            print(player, "doesn't have the game pass...")
        end
    end)
end)


Hello, AzbenNR!

local id = 1082986441
local billboardgui = script:WaitForChild("BillboardGui")

game.Players.PlayerAdded:connect(function(player)
    if game:GetService("GamePassService"):PlayerHasPass(player, id) then
      local b = billboardgui:Clone()
      b.Parent = player.Character
      b.Parent.Position = player.Character.Head.Position + Vector3.new(0, 1, 0) -- Sets the bilboard gui position at the player's head position(with a offset)
    else
        print(player.Name .. " doesn't have the game pass...")
    end
end)

(To make the bilboard gui be shown to all players, just plcae the script on a normal script)

Good Luck with your games

1 comment

0

doesn't work on a normal script :/

Roblox replaced the GamePassService with Marketplace Service.

Try this:

local billboardGui = game:GetService("ServerStorage"):WaitForChild("Gui")

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
	if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, 00000) then 
		local clonedGui = billboardGui:Clone()
		clonedGui.Parent = game.Workspace:WaitForChild(player.Name).Head
		clonedGui.TextLabel.Text = "Premium"
		player:IsLoaded()
	end
	
	end)
end)

Replace the 00000 with your Gamepass ID and put the script along with the billboard gui and text in Server Storage. Also change the "Gui" in the first line to whatever the name of the billboard gui is! Hope this helped! -tawk1215

1 comment

0

doesn't work

This discussion is preserved as it was. New answers, comments, and votes are closed.