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

Running global functions in the studio?

How would I run a function via the command bar in the roblox studio? i.e. if want to make a global weld function I can run both in game and in the studio, what's the best way to go about it? Could I use a module script to do this? How would I call it in studio if I used a module script? Require doesn't seem to work in studio for me.

1 answer

You can use the _G or shared Tables. They are shared to all Scripts.

For instance:

_G.Weld = function()
--code
end

And in the command bar:

_G.Weld()

4 comments

0

Yeah, but I want easy access to the function so I can manipulate it easier. It'd be better if I could put it in a module script or somewhere tangible.

0

Additionally, I couldn't upload the code as a model to easily import it to other places.

0

You can set a Global function from literally any script or ModuleScript. At least test this first.

0

Yeah I know that, I've done this before. It's just not tangible. If I were to use a script to manipulate it, it would have to be in game. What I'm trying to say is I couldn't edit the function in studio without completely redefining the variable.

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