Can I change the location of the humanoid model name display gui?
Yes, you can change the position of the model name display GUI for a humanoid by adjusting the position of the HumanoidRootPart
and the Head
of the model.
Here’s an example of how to move the GUI to the bottom of the character’s feet:
-- Get a reference to the character you want to move the GUI for
local character = game.Workspace.MyCharacter -- Change to the character in question, doesn't have to be workspace.MyCharacter, it can be a character derived from the player object too. Just change this and you'll be fine.
-- Get references to the HumanoidRootPart and Head of the character
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
local head = character:FindFirstChild("Head")
-- If the character has a HumanoidRootPart and a Head, move the GUI to the bottom of the character's feet
if humanoidRootPart and head then
local guiOffset = Vector3.new(0, -2, 0) -- Set the offset of the GUI from the character's feet
-- Get a reference to the model name display GUI
local gui = humanoidRootPart.DisplayName
-- Set the Adornee of the GUI to the character's head, and position it at the bottom of the character's feet
gui.Adornee = head
gui.Offset = guiOffset
-- Make sure the GUI is always visible on top of other objects
gui.AlwaysOnTop = true
end
I haven’t tested it yet, so feel free to tell me if it doesn’t work.
What I want to change is npc, not player.
After slightly modifying the script, I added the script inside the humanoid and tried it, but it didn’t work.
-- Get a reference to the character you want to move the GUI for
local character = game.Workspace.Leaderboard.Top1
-- Get references to the HumanoidRootPart and Head of the character
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
local head = character:FindFirstChild("Head")
-- If the character has a HumanoidRootPart and a Head, move the GUI to the bottom of the character's feet
if humanoidRootPart and head then
local guiOffset = Vector3.new(0, -2, 0) -- Set the offset of the GUI from the character's feet
-- Get a reference to the model name display GUI
local gui = humanoidRootPart.DisplayName
-- Set the Adornee of the GUI to the character's head, and position it at the bottom of the character's feet
gui.Adornee = head
gui.Offset = guiOffset
-- Make sure the GUI is always visible on top of other objects
gui.AlwaysOnTop = true
end
try this:
-- Get a reference to the NPC you want to move the GUI for
local npc = game.Workspace.NPC
-- Get references to the Head and HumanoidRootPart of the NPC
local head = npc:FindFirstChild("Head")
local humanoidRootPart = npc:FindFirstChild("HumanoidRootPart")
-- If the NPC has a Head and a HumanoidRootPart, move the GUI to the bottom of the NPC's feet
if head and humanoidRootPart then
local guiOffset = Vector3.new(0, -2, 0) -- Set the offset of the GUI from the NPC's feet
-- Get a reference to the model name display GUI
local gui = humanoidRootPart.DisplayName
-- Set the Adornee of the GUI to the NPC's head, and position it at the bottom of the NPC's feet
gui.Adornee = head
gui.Offset = guiOffset
-- Make sure the GUI is always visible on top of other objects
gui.AlwaysOnTop = true
end
if this doesn’t work i wont be able to help you as my limits are here, ik it’s like the same code but try,
and make sure its in the humanoid
edit: my bad its already in the humanoid
Thank you, but it doesn’t work…
do you see any errors, does it move at all?
also, make sure its not anchored or locked, as it may prevent gui from moving (i think)
check that displayname is not nil either as it may cause the issue
Yes, there is an error.
gui = humanoidRootPart.DisplayName
DisplayName not found in humanoidRootPart
DisplayName is not a valid member of Part “Workspace.Npc.HumanoidRootPart”
try script.Parent.DisplayName and if that doesnt work, .Name instead
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.