Basically what I am trying to do is:
local path = "game.Players.LocalPlayer.Character.Humanoid" print(path.Health)
Is there any way to do something like this?
Not that I know of. The closest you can probably get is :FindFirstChild()
.
You cannot do this fully, however you can implement a String substitute. I haven't tested if you can use a full pathway, however, I'm sure the first reference of the pathway would have to remain legitimate if you could.
Substitution is mainly used to gain access to a descendant that has a whitespace character, making it a mandatory operation to reference it:
local Player = game:GetService("Players").LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Humanoid = Character["Humanoid"] --// or local Character = workspace["Feahren"]
These other answers are wrong, you definitely can do this with LoadStringEnabled set to true.
local path = "game.Players.LocalPlayer.Character.Humanoid" loadstring("print(" .. path .. ".Health)")