Hi, my premium nametag dont work I don't know why here is the script :
01 | local id = 1082986441 |
02 | local billboardgui = script:WaitForChild( "BillboardGui" ) |
03 |
04 | game.Players.PlayerAdded:connect( function (player) |
05 | if game:GetService( "GamePassService" ):PlayerHasPass(player, id) then |
06 | local b = billboardgui:Clone() |
07 | b.Parent = game:GetService( "Players" ).LocalPlayer.Character |
08 | else |
09 | print (player.Name .. " doesn't have the game pass..." ) |
10 | end |
11 | end ) |
with a billboardgui inside of the script but ingame it's doesn't show the * PREMIUM * :( Thanks for the help.
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:
01 | local id = 1082986441 |
02 | local billboardgui = script:WaitForChild( "BillboardGui" ) |
03 |
04 | game.Players.PlayerAdded:connect( function (player) |
05 | if game:GetService( "MarketplaceService" ):UserOwnsGamePassAsync(player.UserId, id) then |
06 | local b = billboardgui:Clone() |
07 | b.Parent = game:GetService( "Players" ).LocalPlayer.Character |
08 | else |
09 | print (player.Name .. " doesn't have the game pass..." ) |
10 | end |
11 | end ) |
Hope this works!
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.01 | wait() |
02 | local Players = game:GetService( "Players" ) |
03 | local MarketplaceService = game:GetService( "MarketplaceService" ) |
04 | local id = 1082986441 |
05 | local billboardgui = script.BillboardGui |
06 |
07 | local function hasPass(plr) |
08 | return MarketplaceService:UserOwnsGamePassAsync(plr.UserId, id) |
09 | -- return true if they have the id, return false if not |
10 | end |
11 |
12 | game.Players.PlayerAdded:Connect( function (player) -- :connect is deprecated, use :Connect. also, this is the player, use this and not LocalPlayer |
13 | player.CharacterAdded:Connect( function (character) -- wait for character! |
14 | if hasPass(player) then -- if they have the pass |
15 | local b = billboardgui:Clone() |
Hello, AzbenNR!
01 | local id = 1082986441 |
02 | local billboardgui = script:WaitForChild( "BillboardGui" ) |
03 |
04 | game.Players.PlayerAdded:connect( function (player) |
05 | if game:GetService( "GamePassService" ):PlayerHasPass(player, id) then |
06 | local b = billboardgui:Clone() |
07 | b.Parent = player.Character |
08 | b.Parent.Position = player.Character.Head.Position + Vector 3. new( 0 , 1 , 0 ) -- Sets the bilboard gui position at the player's head position(with a offset) |
09 | else |
10 | print (player.Name .. " doesn't have the game pass..." ) |
11 | end |
12 | end ) |
(To make the bilboard gui be shown to all players, just plcae the script on a normal script)
Good Luck with your games
Roblox replaced the GamePassService with Marketplace Service.
Try this:
01 | local billboardGui = game:GetService( "ServerStorage" ):WaitForChild( "Gui" ) |
02 |
03 | game.Players.PlayerAdded:Connect( function (player) |
04 | player.CharacterAdded:Connect( function (char) |
05 | if game:GetService( "MarketplaceService" ):PlayerOwnsAsset(player, 00000 ) then |
06 | local clonedGui = billboardGui:Clone() |
07 | clonedGui.Parent = game.Workspace:WaitForChild(player.Name).Head |
08 | clonedGui.TextLabel.Text = "Premium" |
09 | player:IsLoaded() |
10 | end |
11 |
12 | end ) |
13 | 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