Help with a script

Okay, I’m just going to go from the beginning on how I would make this. I’ll reply once it’s done

esentially, place a regular script into serverscript service.
Make sure billboard gui stays in serverstorage along with the tag. Then copy and paste this code into your script and change the necessary values. This script does work and I tried it for myself.

--variables
 local MarketplaceService = game:GetService("MarketplaceService")
    local Players = game:GetService("Players")
    local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
    local gamePassID = 12726911 -- change to whatever ur gamepass id is

    local function onPlayerAdded(player) -- use a local function to detect when a player joins, and then whatever is inside the function will run.
    	
    	local hasPass = false -- automatically sets haspass to false so the when the next function runs, it'll check to see if the player has that gamepass.
    	
    	local success, message = pcall(function()
    		
    		hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID) 
    		
    	end)
    	
    	if not success then
    		
    		warn("Player does not have pass " .. tostring(message)) -- tells the player they dont have the gamepass.
    		
    		return
    			
    	end
    	
    	if hasPass == true then -- if player has the game pass run everything in the function along with its conditions.
    		
    		print(player.Name .. " Has pass " .. gamePassID) -- basically lets you and the server know the player has the desired pass.
    		
    		player.CharacterAdded:Connect(function(character) -- connect to the character
    			wait() -- important, if you don't have this wait() then the function will run faster than the character can load, that's why we need a wait.

    			if player.Name == "DeityMinds" then --change this to your player username.
    				
    				if character.Head:FindFirstChild("BillboardGui") then
    					
    				else
    					
    					local clonedgui = billboardgui:Clone()
    					
    					clonedgui.TextLabel.Text = "Scripter" -- change to whatever you want your tag to say.
    					
    					clonedgui.TextLabel.TextColor3 = Color3.fromRGB(225, 21, 232)
    					
    					clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
    					
    				end
    				
    			end
    			
    		
    		end)
    		
    	end
    	


    end

    Players.PlayerAdded:Connect(onPlayerAdded) -- connecting the function we made above.

esentially, place a regular script into serverscript service.
Make sure billboard gui stays in serverstorage along with the tag. Then copy and paste this code into your script and change the necessary values. This script does work and I tried it for myself.

--variables
 local MarketplaceService = game:GetService("MarketplaceService")
    local Players = game:GetService("Players")
    local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
    local gamePassID = 12726911 -- change to whatever ur gamepass id is

    local function onPlayerAdded(player) -- use a local function to detect when a player joins, and then whatever is inside the function will run.
    	
    	local hasPass = false -- automatically sets haspass to false so the when the next function runs, it'll check to see if the player has that gamepass.
    	
    	local success, message = pcall(function()
    		
    		hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID) 
    		
    	end)
    	
    	if not success then
    		
    		warn("Player does not have pass " .. tostring(message)) -- tells the player they dont have the gamepass.
    		
    		return
    			
    	end
    	
    	if hasPass == true then -- if player has the game pass run everything in the function along with its conditions.
    		
    		print(player.Name .. " Has pass " .. gamePassID) -- basically lets you and the server know the player has the desired pass.
    		
    		player.CharacterAdded:Connect(function(character) -- connect to the character
    			wait() -- important, if you don't have this wait() then the function will run faster than the character can load, that's why we need a wait.

    			if player.Name == "DeityMinds" then --change this to your player username.
    				
    				if character.Head:FindFirstChild("BillboardGui") then
    					
    				else
    					
    					local clonedgui = billboardgui:Clone()
    					
    					clonedgui.TextLabel.Text = "Scripter" -- change to whatever you want your tag to say.
    					
    					clonedgui.TextLabel.TextColor3 = Color3.fromRGB(225, 21, 232)
    					
    					clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
    					
    				end
    				
    			end
    			
    		
    		end)
    		
    	end
    	


    end

    Players.PlayerAdded:Connect(onPlayerAdded) -- connecting the function we made above.

edit - player has to reset before seeing the name tag after purchasing. Other than that, it works.
@RingsOfSaturn59

1 Like

thank you so much for the answer its working !! but one last thing, fro the people only own the gamepass vip and don’t have special status like me, don’t have the vip tag above the head, for ex : fannymelody have nothing above her head and she reset but still nothing.
what i should do ?

Thats because that script will only work for you. If you want her to have the pass as well, then you can add to the function. Copy and paste this and change the usernames to the yours and your friends.

local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
local gamePassID = 12726911 -- change to whatever ur gamepass id is

local function onPlayerAdded(player) -- use a local function to detect when a player joins, and then whatever is inside the function will run.

	local hasPass = false -- automatically sets haspass to false so the when the next function runs, it'll check to see if the player has that gamepass.

	local success, message = pcall(function()

		hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID) 

	end)

	if not success then

		warn("Player does not have pass " .. tostring(message)) -- tells the player they dont have the gamepass.

		return

	end

	if hasPass == true then -- if player has the game pass run everything in the function along with its conditions.

		print(player.Name .. " Has pass " .. gamePassID) -- basically lets you and the server know the player has the desired pass.

		player.CharacterAdded:Connect(function(character) -- connect to the character
			wait() -- important, if you don't have this wait() then the function will run faster than the character can load, that's why we need a wait.

			if player.Name == "DeityMinds" then --change this to your player username.

				if character.Head:FindFirstChild("BillboardGui") then

				else

					local clonedgui = billboardgui:Clone()

					clonedgui.TextLabel.Text = "Scripter" -- change to whatever you want your tag to say.

					clonedgui.TextLabel.TextColor3 = Color3.fromRGB(225, 21, 232)

					clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head

				end

			end

			if player.Name == "Player" then --change this to your player username.

				if character.Head:FindFirstChild("BillboardGui") then

				else

					local clonedgui = billboardgui:Clone()

					clonedgui.TextLabel.Text = "Builder" -- change to whatever you want your tag to say.

					clonedgui.TextLabel.TextColor3 = Color3.fromRGB(225, 21, 232)

					clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head

				end

			end
		end)

	end



end

Players.PlayerAdded:Connect(onPlayerAdded)
1 Like

If you also want just regular players who buy the game pass to have a different name tag like “VIP” or something, then copy this code

And paste it at the bottom of the second ‘end’ in the if statement for “if player.Name == “Player” then”. Then simply remove "if player.Name == “Player” and change it to “if player.Name then” And just change what you want the name tag text to be. “VIP” if you wanted.

1 Like

I reccemend testing if there UserId is equal to a certain UserId, since you can change your username.