So I have a problem in roblox studio where I clone a nameplate to the head of the player, but it doesn't show the nameplate for the owner, but it completely works fine for me. On the test experience, the nameplate works for the both of us when we tested it. But it didn't clone to her head on the main experience, but it cloned for me. I tried print debugging, it said "Setting nameplate for {playername}" but the player still didn't have the nameplate above her head. Here's the script:
local nameplate = game.ReplicatedStorage:WaitForChild("Nameplate")
game.Players.PlayerAdded:Connect(function(player)
local function setNameplate(character)
print("Setting nameplate for ", player.Name)
if not character then
print("Character not found")
end
local head = character:FindFirstChild("Head")
if not head then
print("Head not found")
return
end
local humanoid = character:FindFirstChild("Humanoid")
if not humanoid then
print("Humanoid not found")
return
end
humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
local nameplateClone = nameplate:Clone()
nameplateClone.Parent = head
local playerNameValue = player:WaitForChild("PlayerName")
local playerHouseValue = player:WaitForChild("PlayerHouse")
local nameLabel = nameplateClone:FindFirstChild("Name")
if nameLabel then
nameLabel.Text = playerNameValue.Value
end
nameplateClone.HouseLabel.Text = playerHouseValue.Value
nameplateClone.username.Text = "(@".. player.Name .. ")"
playerNameValue:GetPropertyChangedSignal("Value"):Connect(function()
nameplateClone:FindFirstChild("Name").Text = playerNameValue.Value
end)
playerHouseValue:GetPropertyChangedSignal("Value"):Connect(function()
nameplateClone.HouseLabel.Text = playerHouseValue.Value
end)
if player.Name == "divinesinsss" or player.UserId == 7339480688 then
nameplateClone:FindFirstChild("HouseLabel").Text = "Blood of Old Valyria"
nameplateClone:FindFirstChild("HouseLabel").TextColor3 = Color3.fromRGB(179, 28, 15)
nameplateClone.HouseLabel.UIGradient.Color = ColorSequence.new({
ColorSequenceKeypoint.new(0, Color3.fromRGB(179, 28, 15)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(68, 5, 5))
})
nameplateClone:FindFirstChild("HouseLabel").UIStroke.Color = Color3.fromRGB(68, 5, 5)
end
end
local character = player.Character or player.CharacterAdded:Wait()
setNameplate(character)
player.CharacterAdded:Connect(setNameplate)
end)
local changeNameEvent = game.ReplicatedStorage.RemoteEvents:WaitForChild("ChangeName")
changeNameEvent.OnServerEvent:Connect(function(player, newName)
local playerNameValue = player:FindFirstChild("PlayerName")
local head = player.Character:WaitForChild("Head")
local nameplate = head:FindFirstChild("Nameplate")
nameplate:FindFirstChild("Name").Text = newName
playerNameValue.Value = newName
end)