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

Assign a function of an instance to a variable?

Asked by 5 years ago

Is it impossible to assign a function of an instance to a variable for convenience? If so, why?

For example,

1local GET = game:GetService("HttpService").GetAsync
2 
3local response = GET("https://example.com")

ends up with this error:

Expected ':' not '.' calling member function GetAsync

1 answer

Log in to vote
1
Answered by
0msh 333 Moderation Voter
5 years ago

it's :GetAsync not .GetAsync

0
You misunderstand, I'm trying to get the actual function as an object and assign it to a variable, not call it. But it appears I can't. I'm wondering if there's a way to do it that I'm missing or if it's impossible. angeld23 5 — 5y
0
well I was answering why you had that error. And for the other part, say if you have a value, and you want to assign a variable for it. The variable of the value should not include the actual value (.Value) because for most part, it will not work 0msh 333 — 5y
Ad

Answer this question