How do I get rid of the players display name when they first join? I tried doing character.humanoid.DisplayName == " " inside the CharacterAdded event but that didnt work
First of all, can we see the whole script? We need to make sure “character” is a variable.
“humanoid” does not have a DisplayName property, because it does not exist in the character. Make sure to capitalize it.
local DataStoreService = game:GetService("DataStoreService")
local WorkerPointsStore = DataStoreService:GetDataStore("WorkerPoints")
local ActivityPointsStore = DataStoreService:GetDataStore("ActivityPoints")
local groupId = 5774015
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats"
local rank = Instance.new("StringValue",leaderstats)
rank.Name = "Group Rank"
rank.Value = player:GetRoleInGroup(groupId)
local workerPoints = Instance.new("IntValue",leaderstats)
workerPoints.Name = "Worker Points"
workerPoints.Value = WorkerPointsStore:GetAsync(player.UserId) or 0
local activityPoints = Instance.new("IntValue",leaderstats)
activityPoints.Name = "Activity"
activityPoints.Value = ActivityPointsStore:GetAsync(player.UserId) or 0
while wait(60) do
player.leaderstats["Activity"].Value = player.leaderstats["Activity"].Value + 1
end
end)
game.Players.PlayerRemoving:Connect(function(player)
WorkerPointsStore:SetAsync(player.UserId,player.leaderstats["Worker Points"].Value)
ActivityPointsStore:SetAsync(player.UserId,player.leaderstats["Activity"].Value)
end)
player.CharacterAdded:Connect(function(character)
character.Humanoid.DisplayName == " "
end)
try it out
Why is it a == and not a =? isnt == for loops
Yeah, you should use =
instead of ==
. ==
is used for if
, while
, and other statements to check if something is equal to something else, not to set something equal to something else.
= is used for assignment, == is used for comparison (returns true or false)
Humanoid instances have a property called DisplayDistanceType
. If set to 2, no one will be able to see the name.
(HumanoidDisplayDistanceType | Documentation - Roblox Creator Hub)
You can get rid of this either using Realism mods’s hide player name or set each play’s Namedistance to 2
Just go into StarterPlayer > DisplayDistanceType and set that to 0.
Here’s your solution.
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
end)
end)
I’d put this in it’s own script and name that script HideNames
. Make sure you’re putting scripts in ServerScriptService
note: the thing Little_Joes should also work but I haven’t tested it myself
There’s no need to use a script:
Just go into StarterPlayer > DisplayDistanceType and set that to 0.
This is what you wrote. Sorry, didn’t realize that!