How to handle "per-object" scripts with Rojo?

I have been using Rojo for my project, and as someone who is more used to Git and VSCode it has been a great experience.

However there is one issue I am unsure how to resolve:
For example - I have a script in one of my map folders which increments current ClockTime for a day-night cycle. I don’t want it active at all time, so I don’t put it in ServerScriptStorage or similar.

The issue comes from the fact that it is not managed by Rojo, and therefore I have to use Studio to edit it. Sure, it’s a simple script, but the concern comes from the fact that I have to use Studio in the first place.

I also have a few scripts in a few parts that make them move. I could seperate the script and give them a tag and perhaps use CollectionService to add that script to them, but I feel like there has to be a better way to do that.

Sorry if this sounds confusing, but I am just really unsure what to do about this stuff.

1 Like

I might be wrong in not understanding what you’re saying but
If you dont want the script to run, couldnt you simply just add to the code to well, make it not run when not needed?

I’ve never used Rojo so I can’t say for certain but it seems you’re making things more complicated by using it.

If its just the same code copy and pasted as scripts into multiple parts, I’d suggest not doing that at all. Ideally you should be using CollectionService as you mentioned.

This seems like you’re trying to do workarounds in order to continue to use Rojo?

I am going to go on a whim and assume you’re somewhat new to Studio. In that case, I’d highly suggest getting familiar with Studio first before deciding to use Rojo so you know the limitations and use case for Rojo rather than brute forcing it. Don’t force yourself to use a tool if its going to cause you more trouble than its worth.

1 Like

For your first point - I think it would be more trouble than it’s worth. As is, it works like this - The map loads, the script runs in workspace. The map unloads, the script is destroyed with it and doesn’t run anymore.

I think I understand the limitations and use-cases pretty well. However, I come from a general gamedev/programming background, so I would prefer to not have to switch my workflow to make scripts in Studio (Since no other engine works this way. Although in all fairness Roblox is quite different to most engines as is). I would very much prefer to handle all scripting in one place.

It may be naive in a way, because I think, or rather hope, that I can do that, but as is I don’t see a good way to do so, at least not without sacrificing the rest of my workflow, hence this question. As you said - I shouldn’t use it if it’s gonna be more trouble than it’s worth, and only ways I can see of making scripts fully managed by Rojo will be just that.

Although that technically works, I think it’d be more wise to keep 99% of scripts away from workspace and avoid relying on the deletion of the map to stop the script from running. ServerScriptService is meant to hold and handle scripts so handling it in there would make more sense imo. In addition, its ALOT more easier to know what scripts are running just by glancing at serverscriptservice rather than attempting to search through workspace incase a bug or memory leak pops up.

I’m not sure how your game functions but if the game does load the map again later, you would be basically constantly cloning and destroying a script.

I also looked up a quick Rojo video for reference and all it really seems to be is a more convenient way to use an external program that syncs up code to studio. So in reality, you’d still need to interact with studio to handle other things. You can still keep all the coding within the Rojo side, but adding tags to objects would just be done in studio with the tag editor or other methods.

TL:DR
Seems a bit archaic to destroy a script to stop it from running, also would recommend avoid putting scripts in workspace for the most part. For the parts that have scripts in them, just go into studio and tag with the tag editor, then script whatever you want in Rojo to handle those tagged objects.

1 Like

You definitely have a point about using ServerScriptService for stuff like that.

Using CollectionService with a premade script in Rojo also seems like the only real good solution. Chances are there will still be things I might need to script in Studio(Not including the case mentioned above) but oh well, it’s not the end of the world if it’s gonna be easier than trying to setup some unnecessary workaround to keep it in Rojo.

Thanks for your time!

1 Like

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