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

VIP Player Billboard wont work?

Asked by
ABK2017 406 Moderation Voter
5 years ago

I'm sure I'm missing something, but I'm not sure what it is.....Here's what I have so far... If I take out the "MarketplaceService", the script works fine, but obviously gives it to everyone. Thanks.

game.Players.PlayerAdded:connect(onPlayerRespawned)
function onPlayerRespawned(newPlayer)
        wait(1)

    local allow = (
        game:GetService('MarketplaceService'):UserOwnsGamePassAsync(player.userId, 1234567) 
    )

    if allow then
        local gui=Instance.new("BillboardGui")
        gui.Parent=newPlayer.Character.Head
        gui.Adornee=newPlayer.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
function onPlayerEntered(newPlayer)
    newPlayer.Changed:connect(function (property)
        if (property == "Character") then
            onPlayerRespawned(newPlayer)
        end
    end)
end

game.Players.PlayerAdded:connect(onPlayerEntered)

1 answer

Log in to vote
-1
Answered by
MAKKU 37
5 years ago
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
Thank you ABK2017 406 — 5y
Ad

Answer this question