Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Help with DisplayDistanceyType == "None"???

Asked by
FiredDusk 1466 Moderation Voter
7 years ago

The DisplayDistanceyType is not even changing and I get no error at all, thanks for help.

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        for i,v in pairs(char) do
            while wait() do
                v:WaitForChild("Humanoid").DisplayDistanceType = "None"
            end
        end
    end)
end)

1 answer

Log in to vote
1
Answered by 7 years ago

I don't know why you are looping through the character or having infinite loop inside? This would mean that only the 1st instance in the for loop will be checked then you wait for the child humanoid, but since v is a object inside of the character then it will not also have a child called humanoid.

I think that you need to go back and what you are trying to do with this code as there is no logical end.

If you only wanted to set the display distance type then use "char" as this is the players character model which will have a child humanoid.

Also I would highly recommend that you use "Enums" as they are managed by roblox meaning if there is an update then the state "None" could change but the enums would be updated.

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        char:WaitForChild("Humanoid").DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
    end)
end)
0
The issue isn't so much that there is no logical end as there is no logic User#6546 35 — 7y
Ad

Answer this question