ModuleScript Loading in Studio but not in game?

I made a running script with stamina, and today I decided to remake it. One new thing I added was storing my values in a ModuleScript inside the Run LocalScript. In Studio it works perfectly but in-game it gives me this error and I can’t do anything
Capture

script V

--// SERVICES
local RS = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local TS = game:GetService("TweenService")
local ReplStorage = game:GetService("ReplicatedStorage")
local Event = ReplStorage.Events:WaitForChild("StaminaEvent")

--// CONFIG
Config = require(script.Config)

The script might be running before the ModuleScript finishes loading. Did you try WaitForChild?

Config = require(script:WaitForChild("Config"))

I thought that require() already waited for the script?
anyways, it worked, thank you!

1 Like

Maybe? I’m not fully sure on that but the problem happens before require is called. Everything inside of the parentheses needs to ‘resolve’, and script.Config should resolve to the Config module, but instead errors before require is even called.

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