! This is just a thread to inform anyone who is experiencing the same problem !
I just spent about an hour and a half figuring out that on the player’s character loading (with the headless equipped) the headless is not loaded immediately, in fact, before it is applied it is possible to obtain another head which is subsequently eliminated…
This is an example where I try to add a BillboardGui on the player’s head:
players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local head = char:FindFirstChild("Head")
if head then
local newTag = Overhead:Clone()
local name = newTag:FindFirstChild("Name")
local rank = newTag:FindFirstChild("Rank")
if name and rank then
name.Text = plr.Name
rank.Text = "Rank"
newTag.Parent = head
-- In the next line i copyed the head that loaded before the headless in the workspace
head:Clone().Parent = workspace
end
end
end)
end)
local function addTag(plr, head)
if not head:FindFirstChild(Overhead.Name) then -- Prevent duplication
local newTag = Overhead:Clone()
local name = newTag:FindFirstChild("Name")
local rank = newTag:FindFirstChild("Rank")
if name and rank then
name.Text = plr.Name
rank.Text = "Rank"
newTag.Parent = head
end
end
end
players.PlayerAdded:Connect(function(plr)
local childConnection = nil
plr.CharacterAdded:Connect(function(char)
if childConnection then
childConnection:Disconnect()
end
childConnection = char.ChildAdded:Connect(function(part)
if part.Name == "Head" then
addTag(plr, part)
end
end)
local head = char:FindFirstChild("Head")
if head then
addTag(plr, head)
end
end)
end)
local Game = game
local Players = Game:GetService("Players")
local function OnPlayerAdded(Player)
local function OnCharacterAdded(Character)
local function OnChildAdded(Child)
if (Child.Name ~= "Head") or not (Child.MeshId == "http://www.roblox.com/asset/?id=134079402" and Child.TextureId == "http://www.roblox.com/asset/?id=133940918") then return end
--Do code here.
end
Character.ChildAdded:Connect(OnChildAdded)
for _, Child in ipairs(Character:GetChildren()) do
OnChildAdded(Child)
end
end
Player.CharacterAdded:Connect(OnCharacterAdded)
end
Players.PlayerAdded:Connect(OnPlayerAdded)
Bare in mind this is a specific implementation for the ‘Headless Horseman’ package.