Game works in studio, but breaks on Roblox?

Hello!

Recently I organised my game for it to look cleaner and easier to understand. I came across this video and I really liked the Modular Approach.

It should be the last one.

I set it up exactly like in the video, and it worked just great in Roblox Studio, but when I play-tested it on Roblox no script worked.

I’m talking specifically about the client sided ones (camera bobbing, footstep sounds, sprinting etc).

I haven’t tested for the Server sided scripts, but I doubt they work.

So, does anyone know why this happens?
I really enjoy this method of organising and I want to use it further.

Please help

Have you tried activating http and api Service?

I do have them activated, it still does not work

Did you publish the game before playing it

Of course, I published it like 5 times but it still does not work

Have you checked your developer console at all? Add a few print statements to your code and try to debug from there.

Yes.
I added a print in every :Init() function in each module. It prints in Studio, but in Roblox it does not print anything in the console. Not even errors.

I would recommend instead of testing multiple scripts, you should try and get 1 script working first. You should test with a basic script init first, preferably just a print statement and with the script being alone.

Here are some potential leads to where the problem could be.

  1. Not all your scripts/models/dependencies have loaded before you started the client script. Scripts might be checking for a part or another asset that hasn’t loaded in yet, causing it to error or get stuck in a wait loop.
  2. The entire module is run by a single LocalScript (Client) or Script (Server). Make sure this script actually reaches the modules by having it print out its requires and :Init()s.
  3. Depending on how the Client runner script is executing the models, it may be doing it in sequence on the same thread. This means that if even 1 script is stuck loading/waiting in the init() block, no other scripts will run.
  4. Implementation error: you did something wrong while setting up the structure the video showed.
1 Like

Hi again.

Thanks for the replies.
I have tried everything, but it still does not work, so I’ll let you see the entire organisation thing.

Here is the Explorer:
Screenshot 2024-03-27 152157

As you can see I have 2 folders Modules and Utils. Basically they both contain module scripts. I also have a LocalScript. This just initializes all of the modules.

Here’s an example of a module script:


So the main function is the :Init() function. It’s in every module script.

Then we have the LocalScript:


(ignore the commented code)

In here is just call the :Init() function from every module script and pass the necessary arguments. (in this case a string)

Now I’ll test it in Studio:
Screenshot 2024-03-27 152900
Look at that! It works!

Now let’s go play it on the Roblox platform.

Why is there no print?
If I don’t find a solution I’ll probably go back to regular LocalScripts, but I enjoy this method a lot more.

Tried it. Still does not work.

I even published it on a new game and it still doesn’t work.

Have you checked here?

I’ve read it again, just to be sure. Nowhere does it mention any of my problems.

Like I said, the scripts work perfectly while testing in Studio, but when actually playing the game on Roblox they don’t even start.

I think it has something to do with you waiting for the character to spawn in

1 Like

Have you enabled Enable Studio access to API services? Had a problem and it helped to get it going.

That’s it! It works now.

Thank you so much. Couldn’t have figured that out on my own!

1 Like

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