How do I get the gui of the scrpt running the modules function?

How do I get the parent of the script trying to run the modules functions so I have a script with a running module function I want to get the scrips parent witch is a GUI how?

2 Likes

why not pass it as a variable?

Im trying to make like a module people can use and call for there guis

somewhere (usualy replicatedstorage) there is a module you call with
somethingui= require(module)

in that module there will be something like

sometable = {}

sometable.thisfunction = function() 
  print("what i want it to do intead of this print")
end

then you call that module with somethingui.thisfunction ()

now here is my proposed change
in the module do

sometable = {}

sometable.thisfunction = function(somevariable) 

  print("what i want it to do intead of this print")
end

and when calling the module do
somethingui.thisfunction (script)

you pass the script as a variable to the function

1 Like

How to I get the scripts parent the script that called the modules function?

1 Like

in my example you can see in the modulescript
sometable.thisfunction = function(somevariable)
and in the script

somethingui.thisfunction (script)

the first variable in the script is the script itself.(first one between the ())
in the function this is stored under the name somevariable (alsow the first one between the ())
if i now do print(somevariable.Parent)
it would print it gets the parent of the script

1 Like