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

A Nametag in the head?

Hey I have made a nametag for my premium members but the nametag is in the head and not on the head here is the script :

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)



If you can help me Thanks :) AzbenNR

2 comments

1

parent the BillboardGui to the character.Head and set its Adornee to the head as well

0

If that worked remember to edit your question title to include "[SOLVED]" so its state is in the answered state, and so people know the problem has been solved

1 answer

An example, as incapaz said...

game.Players.PlayerAdded:connect(function(player)

local allow = (
        game:GetService('MarketplaceService'):UserOwnsGamePassAsync(player.UserId, 1) 
    )

    if allow then
        local gui=Instance.new("BillboardGui")
        gui.Parent=player.Character.Head
        gui.Adornee=player.Character.Head
        gui.Size=UDim2.new(3,0,4,0) 
        gui.StudsOffset=Vector3.new(0,1,0)
        local name=Instance.new("TextLabel")
        name.Parent = gui
        name.BackgroundTransparency = 1
        name.Text = "VIP"  
        name.Size = UDim2.new(1,0,1,0)
        name.Position=UDim2.new(0,0,-0.81,0)
        name.TextColor3=Color3.new(255,255,255)
        name.FontSize = "Size18"
        end
end)

16 comments

0

doesn't work :/

0

Last I checked it worked fine... Did you set your Gamepass? Where is the script stored?

0

The script is in ServerScriptService

0

Did you change line 2 to your gamepassID, replacing the “1”?

0

Yes, look at the screenshot

0

I see you did...standby

0

Try it as a local script, see if it works then...then we can modify it if needbe

0

doesn't work too :(

0

You created a LocalScript and put it in the PlayerGui etc as a test?

0

ohhh

0

It should work as a local script, it doesnt need to use a RE unless you wanted the player to have some sort of interaction with it, ie - a shop gui

0

it's doesn't work :/

0

ABK ?

0

Sorry I am not at my computer, as soon as I can get to it I will try to find the problem and amend my answer...have you tried it with no spaces in the name.Text? Ie “Premium”

0

Why are you using a completely new script that ABK gave you? Your own is completely fine and just needed two more lines of code to work.

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