Getting local scripts to desired locations in packages

Hello, this question might be pretty technical, but it’s actually pretty simple. I can’t seem to solve it, though.

Say I was creating a package, or a model asset that I was about to sell that created explosions where ever you clicked. For example:


Now, in the client, there are of course LocalScripts, but in the server there are Scripts. Scripts run in the workspace, LocalScripts don’t. How would I get the LocalScripts to where they need to be? Again, this question is probably really easy to solve, but I already tried reparenting, but there still are other resources in the main package, and what if the person reparents the package? Then I won’t know where to find those resources! Please help, is it just me?

LocalScripts only run when parented inside a Player or a Player’s character. You’ll have to use remote event or use a connection to get the local scripts to run for when the explosions are created (assuming you want all players to see the explosion.)

This is sort of what I’m saying, but how do I get the local scripts to get in the player, without just manually telling the user to parent the local scripts to the desired location, and not moving the main package out of the workspace? I mean, what if they want to move it around? I want to make the package flexible.

Hm… I have a different idea, not sure if it works for your case but here it is:

If you change the class of the script to “Script” but set the RunContext property of it to “Client”, it will work like a LocalScript but it will work anywhere (including the Workspace, and most importantly in this case, your package.)

1 Like


You are a certified 100% genius. I will try it and see if it solves my problem.

Do I have to change the context at runtime? Or can I just change it in studio?

In the Studio. I don’t believe you could change it at runtime.

1 Like

Pure genius. I don’t even know how you figured it out, but you are pure genius.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.