Overhead UI For Roblox Premium Players isnt loading

I wanted to make this GUI Over the head of Roblox Premium Players.
Since I have no Roblox Premium, I had to edit scripts to show it for me.
The problem is that it’s not showing, I tried everything but I still can’t

Here are the codes. The Original(Used for the game)
and the Modified one (used to check if it works)

Original Code:

-- Services
local serverScriptService = game:GetService("ServerScriptService")
local chatService = require(serverScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local players = game:GetService("Players")

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		if player.MembershipType == Enum.MembershipType.Premium then
			local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")

			local clonedgui = billboardgui:Clone()
			clonedgui.Parent = char:FindFirstChild("Head")
			clonedgui.ImageLabel.Image = "rbxassetid://6377803675"
			clonedgui.TextLabel.Text = "Premium"
			clonedgui.TextLabel.TextColor = Color3.fromRGB(192,192,192)

			local premium = clonedgui

			chatService.SpeakerAdded:Connect(function(PlrName)
				local speaker = chatService:GetSpeaker(PlrName)
				for _, v in pairs(premium) do
					if players[PlrName].Name == v then
						speaker:SetExtraData('Tags',{{TagText = 'Premium', TagColor = Color3.fromRGB(255,255,255)}})
					end
				end
			end)
		end
	end)
end)

Modified Code:

-- Services
local serverScriptService = game:GetService("ServerScriptService")
local chatService = require(serverScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local players = game:GetService("Players")

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		if player.UserId == 1029635682 then
			local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")

			local clonedgui = billboardgui:Clone()
			clonedgui.Parent = char:FindFirstChild("Head")
			clonedgui.PremiumLabelText.Text = "Premium"
			clonedgui.PremiumImageLabel.ImageLabel.Image = ("rbxassetid://6377803675")
			clonedgui.PremiumLabelText.TextLabel.TextColor = Color3.fromRGB(255,255,255)

			local premium = clonedgui

			chatService.SpeakerAdded:Connect(function(PlrName)
				local speaker = chatService:GetSpeaker(PlrName)
				for _, v in pairs(premium) do
					if players[PlrName].Name == v then
						speaker:SetExtraData('Tags',{{TagText = 'Premium', TagColor = Color3.fromRGB(255,255,255)}})
						if clonedgui then
							print("It's Running!")
						end
					end
				end
			end)
		end
	end)
end)

at one part you say

local premium = clonedgui

which makes the premium variable a refrence to the cloned gui instance. You then later do:

for _v, in pairs(premium) do

which wont really do anything, since you can’t really loop through a gui instance - so this may be part of your problem.

I’m also not too sure what the

if players[PlrName].Name == v then

is doing, especially since v would be a value so it would be better to say

if players[PlrName].Name == v.Name then

or

if players[PlrName] == v then

however I’m not sure if that will fix it sice the v isn’t going to hold anything of value since you are looping through premium which still points to a billboardgui instance.

Also, I’m not sure if chat service is something you’re supposed to require, but I may be wrong on that one.

Here’s some other ways you can troubleshoot:
In the explorer, find your character and see if the GUI is actually being placed in the first place. If it is, then the problem probably isn’t in your script, but how the GUI is being set up. Otherwise, you know there might be something going wrong in your code. In that case, I’d try putting prints at different parts of the code to track down where something goes wrong if there are no error messages.

Hope this helps!

2 Likes