Overhead Gui [Updated!]

Hello developers!

I would like to announce that I’ve made an open source over head GUI! A while back I made an over head GUI and… Well it, wasn’t that good. Now, is this better then the top downloaded one? No, it’s not. This is more of testing what I can do, while adding to the Roblox Developer Community.


:warning: Marketplace code is outdated. Please use the code used in this post. Also set Image instance .Visible to false


Images


Set up

After importing the model, put it in ServerScriptService. Click on the script and adjust the attributes if needed.
image

Name What it does
IfStarCreator Adds badge if player is a star creator
IsGroupEnabled Allows option to add group
IsPremiumEnabled Adds badge if player has Premium
RobloxAdminIcon If the player is a Roblox Admin
UseDisplayName Uses the players DisplayName and removes “@”
VerifiedUser Checks if the player has the Verified Badge

Adding Group

To and a group go to OverheadGuiScript and open it. Edit GroupPlayerIsIn number to your group ID.

To add a image create something like this local MyImage = 69420 and change “69420” to your image ID. Put that on Line 25.

Copy this and put it on Line 59. Make sure to change 255 to your group role.

if Player:GetRankInGroup(GroupPlayerIsIn) == 255 then
	local ImageClone = OverheadGuiImage:Clone()
	ImageClone.Parent = OverheadGuiClone.Background
	ImageClone.Image = string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", MyImage) -- Change "MyImage" to whatever you named your icon
end

Code

--[[

Script created by @Koolkp5

Hello, this is an open source overhead Gui. Feel free to edit anycode!

If you don't know how to add more roles, check the post on the DevForum.

--> https://devforum.roblox.com/t/overhead-gui-updated/2321372

]]--

-- Services
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")

-- Locals
local OverheadGui = script.OverheadGui

local VerifiedImageId = 11207341678 -- Verified Check Image
local StarCreatorImageId = 11322155024 -- Star Creator Image
local DeveloperImageId = 10885640695 -- Developer Image
local RobloxIconImageId = 12932462702 -- Roblox Admin Image
local PremiumImageId = 10885647377 -- Premium Image

local GroupPlayerIsIn = 7 -- 🔶 Change "7" to the group ID if needed.
local RoleInGroup = 255 -- 🔶 Change this if needed.

local IsGroupEnabled = script:GetAttribute("IsGroupEnabled")
local UseDisplayName = script:GetAttribute("UseDisplayName")
local RobloxAdminIcon = script:GetAttribute("RobloxAdminIcon")
local VerifiedUser = script:GetAttribute("VerifiedUser")
local IsPremiumEnabled = script:GetAttribute("IsPremiumEnabled")
local IfStarCreator = script:GetAttribute("IfStarCreator")

-- PlayerAdded
Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		
		task.wait(1)
		
		local OverheadGuiClone = script:WaitForChild("OverheadGui"):Clone() -- Clones OverHeadGui
		OverheadGuiClone.Parent = Character:WaitForChild("Head")
		OverheadGuiClone.Adornee = Character.Head
		
		local OverheadGuiImage = OverheadGuiClone.Background.Image
		
		if UseDisplayName == true then -- Checks if UseDisplayName true
			OverheadGuiClone.Background.Username.Text = Player.DisplayName
		else
			OverheadGuiClone.Background.Username.Text = "@"..Player.Name-- I added an "@" to say that this is a username and not display name. But it's not needed
		end

		if IsGroupEnabled == true then -- Checks if IsGroupEnabled. If so, checks if player is in that group.
			if Player:IsInGroup(GroupPlayerIsIn) then
				
				if Player:GetRankInGroup(GroupPlayerIsIn) == RoleInGroup then
					local ImageClone = OverheadGuiImage:Clone()
					ImageClone.Parent = OverheadGuiClone.Background
					ImageClone.Image = string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", DeveloperImageId) -- Change "DeveloperImageId" to what ever
					ImageClone.Visible = true
				end
				
			end
		elseif RobloxAdminIcon == true then -- Checks if RobloxAdminIcon is enabled
			if Player:IsInGroup(1200769) then -- Admin group
				local ImageClone = OverheadGuiImage:Clone()
				ImageClone.Parent = OverheadGuiClone.Background
				ImageClone.Image = string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", RobloxIconImageId)
				ImageClone.Visible = true
			end
		elseif VerifiedUser == true then
			if Player.HasVerifiedBadge then -- Checks if player has badge
				print(tostring(Player.HasVerifiedBadge))
				local ImageClone = OverheadGuiImage:Clone()
				ImageClone.Parent = OverheadGuiClone.Background
				ImageClone.Image = string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", VerifiedImageId)
				ImageClone.Visible = true
			end
		end
		
		if IsPremiumEnabled == true then -- Premium
			if Player.MembershipType == Enum.MembershipType.Premium then
				local ImageClone = OverheadGuiImage:Clone()
				ImageClone.Parent = OverheadGuiClone.Background
				ImageClone.Image = string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", PremiumImageId)
				ImageClone.Visible = true
			end
		end
		
		if IfStarCreator == true then -- Star Creator
			if Player:IsInGroup(4199740) then
				local ImageClone = OverheadGuiImage:Clone()
				ImageClone.Parent = OverheadGuiClone.Background
				ImageClone.Image = string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", StarCreatorImageId)
				ImageClone.Visible = true
			end
		end
		
		if Player.UserId == game.CreatorId then -- Checks if player is the creator
			OverheadGuiImage.Image = string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", DeveloperImageId)
		end
	end)
end)
24 Likes

How does this behave when multiple conditions are met? (Is a star creator, developer & premium member) Does it have a priority system based on which condition is more important?

2 Likes

The script creates a new image, so there is no priority system.

Example:

4 Likes

why does this not work anymore?

1 Like

Hello, thanks for tell me about your error! I updated my code to hopefully addresses your problem.

Changes to code

What fixes the error: I added task.wait(1) after CharacterAdded

Fixes bug with verified badge: Just change
visibility of the Image Label.

--[[

Script created by @Koolkp5

Hello, this is an open source overhead Gui. Feel free to edit anycode!

If you don't know how to add more roles, check the post on the DevForum.

--> https://devforum.roblox.com/t/overhead-gui-updated/2321372

]]--

-- Services
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")

-- Locals
local OverheadGui = script.OverheadGui

local VerifiedImageId = 11207341678 -- Verified Check Image
local StarCreatorImageId = 11322155024 -- Star Creator Image
local DeveloperImageId = 10885640695 -- Developer Image
local RobloxIconImageId = 12932462702 -- Roblox Admin Image
local PremiumImageId = 10885647377 -- Premium Image

local GroupPlayerIsIn = 7 -- 🔶 Change "7" to the group ID if needed.
local RoleInGroup = 255 -- 🔶 Change this if needed.

local IsGroupEnabled = script:GetAttribute("IsGroupEnabled")
local UseDisplayName = script:GetAttribute("UseDisplayName")
local RobloxAdminIcon = script:GetAttribute("RobloxAdminIcon")
local VerifiedUser = script:GetAttribute("VerifiedUser")
local IsPremiumEnabled = script:GetAttribute("IsPremiumEnabled")
local IfStarCreator = script:GetAttribute("IfStarCreator")

-- PlayerAdded
Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		
		task.wait(1)
		
		local OverheadGuiClone = script:WaitForChild("OverheadGui"):Clone() -- Clones OverHeadGui
		OverheadGuiClone.Parent = Character:WaitForChild("Head")
		OverheadGuiClone.Adornee = Character.Head
		
		local OverheadGuiImage = OverheadGuiClone.Background.Image
		
		if UseDisplayName == true then -- Checks if UseDisplayName true
			OverheadGuiClone.Background.Username.Text = Player.DisplayName
		else
			OverheadGuiClone.Background.Username.Text = "@"..Player.Name-- I added an "@" to say that this is a username and not display name. But it's not needed
		end

		if IsGroupEnabled == true then -- Checks if IsGroupEnabled. If so, checks if player is in that group.
			if Player:IsInGroup(GroupPlayerIsIn) then
				
				if Player:GetRankInGroup(GroupPlayerIsIn) == RoleInGroup then
					local ImageClone = OverheadGuiImage:Clone()
					ImageClone.Parent = OverheadGuiClone.Background
					ImageClone.Image = string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", DeveloperImageId) -- Change "DeveloperImageId" to what ever
					ImageClone.Visible = true
				end
				
			end
		elseif RobloxAdminIcon == true then -- Checks if RobloxAdminIcon is enabled
			if Player:IsInGroup(1200769) then -- Admin group
				local ImageClone = OverheadGuiImage:Clone()
				ImageClone.Parent = OverheadGuiClone.Background
				ImageClone.Image = string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", RobloxIconImageId)
				ImageClone.Visible = true
			end
		elseif VerifiedUser == true then
			if Player.HasVerifiedBadge then -- Checks if player has badge
				print(tostring(Player.HasVerifiedBadge))
				local ImageClone = OverheadGuiImage:Clone()
				ImageClone.Parent = OverheadGuiClone.Background
				ImageClone.Image = string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", VerifiedImageId)
				ImageClone.Visible = true
			end
		end
		
		if IsPremiumEnabled == true then -- Premium
			if Player.MembershipType == Enum.MembershipType.Premium then
				local ImageClone = OverheadGuiImage:Clone()
				ImageClone.Parent = OverheadGuiClone.Background
				ImageClone.Image = string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", PremiumImageId)
				ImageClone.Visible = true
			end
		end
		
		if IfStarCreator == true then -- Star Creator
			if Player:IsInGroup(4199740) then
				local ImageClone = OverheadGuiImage:Clone()
				ImageClone.Parent = OverheadGuiClone.Background
				ImageClone.Image = string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", StarCreatorImageId)
				ImageClone.Visible = true
			end
		end
		
		if Player.UserId == game.CreatorId then -- Checks if player is the creator
			OverheadGuiImage.Image = string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", DeveloperImageId)
		end
	end)
end)
4 Likes

thank u i was wondering if u could add a device check too , using the icons of pc and mobile!

Yeah!

I do want to say I made this pretty quickly, so it only detects if TouchEnabled & KeyboardEnabled is true.

(Icons used from Image Marketplace, PC and Phone icons)

2 Likes

thats very nice, thank you again, and if i tried to make it would probably take me hours of going through the Documentations , perhaps you seem to be a professional UI developer , Cheers!

1 Like

Hi, there was an bug with device version script, i had to use UserInputService On client side not the server side because when i joined on mobile it still showed up as a pc user but i researched for fix (and even asked my friend about it) then i found out and i did on CLIENT SIDE and joined on phone BAM everything worked, plus added vr/console support so yay, thanks for making script but theres some errors in it like as i said its a very cool script and i been wanting it for a while.

2 Likes