Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Trying to set DisplayDistanceType?

My code is as follows, in a gui (the parent tree is correct) it is in a normal script also

local plr = script.Parent.Parent.Parent
local char = plr:WaitForChild("Character")
local hum = char.Humanoid

hum.DisplayDistanceType = "None"

I do not know why this does not work at all...

1 answer

Your problem isn't line 5 where you are setting the DisplayDistanceType, it's on line 2, you will always be waiting for Character. To properly wait for the character you can use this method:

local plr = game.Players.LocalPlayer
plr.CharacterAdded:wait()
local character = plr

Now your updated code

local plr = script.Parent.Parent.Parent
plr.CharacterAdded:wait() --this waits until the event is fired
local char = plr.Character
local hum = char.Humanoid

hum.DisplayDistanceType = "None"

This discussion is preserved as it was. New answers, comments, and votes are closed.