Local script stopped working when requiring a module

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    For my local script to work again.
  2. What is the issue?
    Literally 10 minutes ago this local script was working that was just executing remote event functions. Now the script just stops working after requiring a camera module
  3. What solutions have you tried so far?
    Removing the module allows the script to work however no errors are happening when the module is being required so I’m not sure what the problem is?

Has anyone had a similar issue?

You can share the scripts. To check them.

Is your Module Script located where the client cannot access it, such as ServerStorage?

It is in replicated storage and i tried putting it in the starter player scripts

print('working')
local RS = game:GetService('ReplicatedStorage')
local TS = game:GetService('TweenService')
local UIS = game:GetService('UserInputService')
local RSS = game:GetService('RunService')
print('working')
local player = game.Players.LocalPlayer
print('working')
local CameraUtil = require(RS.Modules.CameraUtil)
print('working')

the last working that is printed is before the require.

Are you getting errors in the output window?

In your CameraUtil variable try adding :WaitForChild()

local CameraUtil = require(RS.Module:WaitForChild("CameraUtil"))

If there is no error message, it is likely that CameraUtil itself requires a module that in return also requires CameraUtil. Or some other circular dependency is happening like so. This always causes your script to freeze silently with no error.

1 Like

I don’t think this is the case since this is the only script using the module script. I am still looking however.

For some reason the module script only works when a character has spawned. I didn’t make the module so didn’t know this. Sorry for wasting your time. Thanks