Im in the process of creating a small rc tank that is controlled by a player.
the tank works fine however i noticed an annoying problem regarding humanoid display distances.
In the video below I can see the dummy humanoid’s name when my character is close, but when I approach it via the tank the display name does not appear.
ive tried using replicationfocus but that didnt affect humanoid displays.
is there a way I can see humanoid names using the camera instead of the character?
Try making a script that hides and unhides the humanoid name when you get closer by setting the DisplayDistance to math.huge and using Humanoid.DisplayDistanceType. If that doesn’t work out, add a custom name system to the dummy.
I haven’t done much with this kind of thing, but I believe I know how it is caused. I think what is going on here is it is measuring the Magnitude of the player’s root part position - the position of the other humanoid’s root part position. What this means is, if your character is close to the dummy, the dummy’s name should show regardless of where the camera is.
What you could do is measure the Magnitude between your player and the dummy, and locally make the dummy’s NameDisplayDistance property slightly larger than the magnitude. Of course, to do this you would just want to check the magnitude between your camera and the dummy first.
local rs = game:GetService("RunService")
local cam = workspace.CurrentCamera
local char = player.Character
local dummy = nil -- change nil to your dummy model.
local maxdistance = 50
local extradistance = 5
rs.RenderStepped:Connect(function()
local dhum = dummy.Humanoid
if (cam.CFrame.Position-dummy.HumanoidRootPart.Position).Magnitude <= maxdistance then
dhum.NameDisplayDistance = (player.HumanoidRootPart.Position-dummy.HumanoidRootPart.Position).Magnitude+extradistance
end
end)
Might not work on its own, but it should give you an idea. Hope this helps!
that could work. I used the dummy as an example, there are lots of npcs in the game but I can just use collection service and apply the changes to them from there.