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

Running global functions in the studio?

Asked by 9 years ago

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

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
9 years ago

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()
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. aquathorn321 858 — 9y
0
Additionally, I couldn't upload the code as a model to easily import it to other places. aquathorn321 858 — 9y
0
You can set a Global function from literally any script or ModuleScript. At least test this first. adark 5487 — 9y
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. aquathorn321 858 — 9y
Ad

Answer this question