VIP overhead gamepass script not working

I am trying to script, is when you have a gamepass then you get an overhead UI that says “VIP” Bu the script isn’t working.

if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId,11149440) then
	script.Parent.Holder.VIP.Text = "VIP"
end
2 Likes

I would like to see a explorer picture (Picture of the hierarchy of “script.Parent” more likely, but more = better.) and the full script.

There:

image

You might want to clone it then parent it.

Assuming you have the billboard gui in.l replicated storage, and the VIP text Is already inthe gui

local mps = game:GetService("MarketPlaceService") 
game.Players.PlayerAdded:Connect(function(plr)
if mps:UserOwnsGamepassAsync(plr.UserId,11149440) then
    local name = plr.Name
    local clone = game.ReplicatedStorage.BillBoardName:Clone() 
    clone.Parent = game.Workspace.name.Head
end) 
1 Like

Though, even with that code, it would only run once, and after running once, the player wouldn’t have the gui on his head anymore.

@LovinqAidenn

Here’s a code based on TwyPlasma’s:

local mps = game:GetService("MarketplaceService")

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		if mps:UserOwnsGamepassAsync(plr.UserId, 11149440) then
			local PlayerName = plr.Name
			local OverheadGuiClone = game.ServerStorage.BillBoardName:Clone() 
			OverheadGuiClone.Parent = char.Head 
		end
	end)
end)

@LovinqAidenn, I suggest you to place the OverheadGui in ServerStorage, and keep the script at ServerScriptService.

@TwyPlasma, ReplicatedStorage can be accessed from both the client and the server, and, anything on the client is exploitable (Well, yes, this might not influence it all, but… Why not use ServerStorage, right?), but Server-Sided, exploiters can’t access at all.

2 Likes

Why should he though?

Yes, I forgot to add in the character added part sorry.

1 Like

You beat me to it.

But I cannot stress enough how important it is to properly place your elements in the right places. I would only do server scripts within the ServerScriptService and nothing more.

Other elements can go into their rightful places and you can define those places from your script. This script is essentially a great a example and guide of how you should be achieving.

Also, use a pcall to get the UserOwnsGamePassAsync value.