i made an import function on roblox which sets a variable in an environment but currently you have to pass getfenv() through the function for it to work, which kind of ruins the thing i was going for. what are other things i could try?
✓ ANSWER ACCEPTED
How to getfenv() of another script without calling an event from it?
1 answer
✓ Accepted answer
A ModuleScript will do!
Script:
require(workspace.ModuleScript)()
ModuleScript:
return function()
local env = getfenv(2) -- Script
env['message'] = "Hello There!"
setfenv(2,env)
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
this. but you will need to store it in a module table, since this just defines a local variable.
Couldn't you use a BindableEvent? or do you mean change the env?
I see your point.
thanks, i don't understand getfenv() or setfenv() that well