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

A Nametag in the head?

Asked by 6 years ago

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

1
parent the BillboardGui to the character.Head and set its Adornee to the head as well User#19524 175 — 6y
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 User#19524 175 — 6y

1 answer

Log in to vote
0
Answered by
ABK2017 406 Moderation Voter
6 years ago
Edited 6 years ago

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)
0
doesn't work :/ AzbenNR 0 — 6y
0
Last I checked it worked fine... Did you set your Gamepass? Where is the script stored? ABK2017 406 — 6y
0
The script is in ServerScriptService AzbenNR 0 — 6y
View all comments (12 more)
0
Did you change line 2 to your gamepassID, replacing the “1”? ABK2017 406 — 6y
0
Yes, look at the screenshot AzbenNR 0 — 6y
0
I see you did...standby ABK2017 406 — 6y
0
Try it as a local script, see if it works then...then we can modify it if needbe ABK2017 406 — 6y
0
doesn't work too :( AzbenNR 0 — 6y
0
You created a LocalScript and put it in the PlayerGui etc as a test? ABK2017 406 — 6y
0
ohhh AzbenNR 0 — 6y
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 ABK2017 406 — 6y
0
it's doesn't work :/ AzbenNR 0 — 6y
0
ABK ? AzbenNR 0 — 6y
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” ABK2017 406 — 6y
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. xPolarium 1388 — 6y
Ad

Answer this question