Hey, so I’m making a fps and everything’s coded and setted up, and the first time playing, nothing worked. I immediately slapped some prints to identify the line, as there were no errors, and looks like the line that requires my fps module is stopping/yielding the script:
local uis = game:GetService("UserInputService")
local rs = game.ReplicatedStorage
local runService = game:GetService("RunService")
print("print 0") -- prints
local modules = rs:WaitForChild("modules")
local guns = rs:WaitForChild("guns")
local gunRemotes = rs:WaitForChild("gunRemotes")
print("print 1") -- prints
local fpsModule = require(modules:WaitForChild("fpsModule")) -- 😎
print("print 2") -- doesn't print
local cam = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local newGuns = {}
There are no errors, such as “module experienced an error while loading”, “infinite yield on line …”, and I’d like to know what is causing it to stop/yield, and hopefully a fix?
your fpsModule has something that yields/prevents returning in it, such as an Event:Wait(), repeat until, while x do, or something of the like.
Check that everything runs quickly, and if it doesn’t wrap it in a coroutine:
coroutine.wrap(function()
-- code that doesn't run quickly
end)()