! | Issue With Overhead GUI (not showing up)

Setup: The OverheadModule & GuiObject is in ReplicatedStorage. Also, I followed a tutorial for this!
image

Code:
Module Script:

local OverheadGuiObject = script.OverheadGuiObject

local module = {}

function module:Create(Player, GroupId) -- Creates the overhead gui for the player
	local Character = Player.Character or Player.CharacterAdded:Wait() -- Gets the players character

	local Clone = OverheadGuiObject:Clone() -- Clones the ovehead gui to the characters head
	Clone.Name.Text = Player.Name
	Clone.Rank.Text = Player:GetRoleInGroup(5127121)
	Clone.Parent = Character.Head

	Character.Humanoid.NameDisplayDistance = 0
end

function module:Hide(Player) -- Hides a specific players overhead gui
	local Character = Player.Character or Player.CharacterAdded:Wait()

	Character.Head.OverheadGuiObject.Enabled = false
end

return module

Server Script:


local OverheadModule = require(game:GetService("ReplicatedStorage").OverheadModule)

PlayersService.PlayerAdded:Connect(function(Player) -- Fires when the player joins the game

Player.CharacterAdded:Connect(function(Character) -- Fires each time the players character is added

OverheadModule:Create(Player, 5127121) -- Player, GroupId

end)

end)

Notes:
There are no errors, it just does not show up.

1 Like

Alright so what is the actual issue though? Is the UI not showing up?

yeah, it’s not showing up! my bad as i should have specified that

I feel like it has something to do with passing the player through the module, but other than that Im stumped

1 Like

Are you sure there is absolutely nothing in the output?

1 Like

Has the GUI been made invisible using the Visible property by accident?

1 Like

It doesn’t really seem like there’s any errors in your scripts.

You should check if the objects in your GUI actually show up while it’s enabled. Firstly, you could check if the gui is enabled in the first place (you don’t enable it in the Create function).

Adding to what others said,
you should wrap the GetRoleInGroup in a pcall:

local success,result = pcall(function()
  return Player:GetRoleInGroup(ID)
end)
if success then
   Clone.Rank.Text= result
end
1 Like
Clone.Name.Text = Player.Name

The .Name is a property of Clone, so you’re likely getting an error there. Instead, do

Clone:FindFirstChild("Name").Text = Player.Name

Also, I just don’t get the point of using a module script here, that just makes this script more complicated than it should be. I recreated this script in just a script, and it works fine. That just may be me though.

local PlayersService = game:GetService("Players")

local function create(Player, GroupID)
    local OverheadGuiObject = game.ReplicatedStorage:FindFirstChild("BillboardGui") -- Whatever your billboardGui is called
    local guiClone = OverheadGuiObject:Clone()
    local character = Player.Character or Player.CharacterAdded:Wait()
    guiClone:FindFirstChild("Name").Text = Player.Name
    guiClone.Rank.Text = Player:GetRoleInGroup(GroupID)
    guiClone.Parent = character.Head
    
    character.Humanoid.NameDisplayDistance = 0
    --// Next Part to Hide the player from seeing their own nametag
    guiClone.PlayerToHideFrom = Player
end


PlayersService.PlayerAdded:Connect(function(Player) -- Fires when the player joins the game
    Player.CharacterAdded:Connect(function(Character) -- Fires each time the players character is added
        create(Player, 5127121) -- Player, GroupId
    end)
end)
2 Likes

Yes, this could’ve caused that. Tip : avoid naming things in classes’ names.( tip for OP).

1 Like

I find adding a “y” onto the end of these names is funny looking but also helps with reading: “Name” → “Namey”

Should really apply this to anything that relies on external data being brought into the game, the chance of that specific server, or roblox servers in general, being up constantly is unreliable. At least it’d prevent errors and you’d be able to apply alternatives.

Hey there.

I have a few possible reasons as to why this script doesn’t appear to be working for you. Specifically about the UI itself, or the .CharacterAdded() event

Solution 1: UI Visibility

Did you toggle any of the visibility options such as Enabled or Visible to false on certain BillboardGUI’s or Frames, TextLabels, etc? If so, that’s likely why it’s not showing up.

Solution 2: Character isn’t ready

I’ve made countless scripts with the .CharacterAdded() event so I’m really sure it’s this which is the issue.

The client is in charge of letting the server know that it’s loaded, and ready to be controlled, as with most games. The server prepares for the character, however the character might not be ready for the server to use it yet. To fix this, you can yield the script until the PlayerCharacter is ready.

PlayersService.PlayerAdded:Connect(function(Player) -- Fires when the player joins the game
    Player.CharacterAdded:Connect(function(Character)
        Player.CharacterAppearanceLoaded:Wait() -- This will wait indefinitely until the Characters full appearance is loaded. This usually indicates the client is fully deployed for use.

        OverheadModule:Create(Player, 5127121)
    end)
end)

If this didn’t help, you could try doing

repeat task.wait() until Player.Character

But it’s usually more effective for Clients, and the server might end up throwing the same result, but worth the try!

1 Like

This could be dumb but the script seems like it’s disabled…

1 Like