Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

My Premium Nametag doesn't work?

Asked by 6 years ago

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

01local id = 1082986441
02local billboardgui = script:WaitForChild("BillboardGui")
03 
04game.Players.PlayerAdded:connect(function(player)
05    if game:GetService("GamePassService"):PlayerHasPass(player, id) then
06      local b = billboardgui:Clone()
07b.Parent = game:GetService("Players").LocalPlayer.Character
08    else
09        print(player.Name .. " doesn't have the game pass...")
10    end
11end)

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

0
This will only show for the local player, you should test this on a normal script  Leamir 3138 — 6y

4 answers

Log in to vote
0
Answered by 6 years ago

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:

01local id = 1082986441
02local billboardgui = script:WaitForChild("BillboardGui")
03 
04game.Players.PlayerAdded:connect(function(player)
05    if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, id) then
06      local b = billboardgui:Clone()
07b.Parent = game:GetService("Players").LocalPlayer.Character
08    else
09        print(player.Name .. " doesn't have the game pass...")
10    end
11end)

Hope this works!

0
doesn't work AzbenNR 0 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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.

01wait()
02local Players = game:GetService("Players")
03local MarketplaceService = game:GetService("MarketplaceService")
04local id = 1082986441
05local billboardgui = script.BillboardGui
06 
07local function hasPass(plr)
08    return MarketplaceService:UserOwnsGamePassAsync(plr.UserId, id)
09    -- return true if they have the id, return false if not
10end
11 
12game.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()
View all 21 lines...
Log in to vote
-1
Answered by
Leamir 3138 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

Hello, AzbenNR!

01local id = 1082986441
02local billboardgui = script:WaitForChild("BillboardGui")
03 
04game.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 + Vector3.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
12end)

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

Good Luck with your games

0
doesn't work on a normal script :/ AzbenNR 0 — 6y
Log in to vote
-2
Answered by 6 years ago

Roblox replaced the GamePassService with Marketplace Service.

Try this:

01local billboardGui = game:GetService("ServerStorage"):WaitForChild("Gui")
02 
03game.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)
13end)

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

0
doesn't work AzbenNR 0 — 6y

Answer this question