--get a object with the parameter, fullName
local camFullName = workspace.Camera:GetFullName()
print(GetObject(camFullName)) --> workspace.Camera
--OF COURSE THERE AREN'T OBJECTS THAT HAVE SAME NAME.--
What should I code in function GetObject?
What’s the purpose of this exactly? I think I know what you’re after, but there are very few reasons as to why you’d want to do that.
I presume you’re trying to get an instnace from a string, you can use something like this for the code in GetObject
local segments = fullName:split(".")
local current = game
for _,location in pairs(segments) do
current = current[location]
Took it from here and changed it up a bit
You can use string.split() to divide the path into instance names, and then use a loop to go through them:
local current=game --location to search
for i,v in pairs(segments) do
There may be a way to specify the very first location, but if there is, I’m not aware of it.
Basically it splits the full name from the dots, and then uses those splits as a way to navigate through the directory stating from
game and ending up at the location needed
May 22, 2021, 5:49am
love you thats what i was looking for