Diamo_YT
(Diamo)
May 3, 2021, 11:07pm
#1
Basically, I want to call something like :WaitForChild
from a "WaitForChild"
string.
I’ve tried calling it from Instance["WaitForChild"]
, but it returned an error explaining how I needed to call it from a colon instead of a period.
I want to know if it’s possible to do this and if so, how.
Thanks for your time!
1 Like
Galactiq
(Matthew)
May 3, 2021, 11:10pm
#2
I am curious as to why you need to do this. I am unaware of any alternatives of calling the method itself, however I do not know for certain. If you really need this done, could you pass it via a function and check if the string is “WaitForChild”, and act accordingly?
Diamo_YT
(Diamo)
May 3, 2021, 11:15pm
#3
I could, but then I’d have to detect any of all of the methods from all of the classes. As I need support for all classes.
Galactiq
(Matthew)
May 3, 2021, 11:17pm
#4
What is the use case of this? Why can you not simply call methods in standard method syntax?
If you have to do it this way…you can just pass Instance
as the first argument (then the child’s name):
Instance["WaitForChild"](Instance, childName)
3 Likes
Used one of those Loadstring modules to execute a string.
Here’s the string I used.
[[return function(Self, Varient)
return game:GetService("]]..string.split(RealInstance:GetFullName(), ".")[1]..[[")]]..tostring(string.gsub(RealInstance:GetFullName(), string.split(RealInstance:GetFullName(), ".")[1], ""))..[[:]]..Index..[[(Varient)
end]]
Sorry for the hassle!
Diamo_YT
(Diamo)
August 25, 2021, 7:30pm
#7
Yes I found that out. Sorry for not getting back sooner!
a case i currently have is terrain loader script
which returns this error
i wonder if the compiler knows im calling a function why doesnt it just run it