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

Assign a function of an instance to a variable?

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

For example,

local GET = game:GetService("HttpService").GetAsync

local response = GET("https://example.com")

ends up with this error:

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

1 answer

it's :GetAsync not .GetAsync

2 comments

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.

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

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