Hey, so I made a FPS framework. In the main client script where input is controlled etc, the script doesn't run. I placed a bunch of prints in it to see where it is yielding, and apparently it's a line that requires my fps module. Here is the script:

print("printerino 0") -- prints
local uis = game:GetService("UserInputService")
local rs = game.ReplicatedStorage
local runService = game:GetService("RunService")
print("obama") -- prints
local modules = rs:WaitForChild("modules")
local guns = rs:WaitForChild("guns")
local gunRemotes = rs:WaitForChild("gunRemotes")
print("yeet") -- prints
print(modules:WaitForChild("fpsModule").Name) -- prints, used to check if the module exists
local fpsModule = require(modules:WaitForChild("fpsModule")) -- this line right here apparently stops it, no errors in the output
print("modulerino") -- this does not print
local cam = workspace.CurrentCamera
print("camerino")
local player = game.Players.LocalPlayer
print("ye")
local newGuns = {}

local ownedGuns = {
	
	nil,
	"pistol",
	nil,
	
}
print("yeeterino")
local newGun,ammoData = gunRemotes.new:InvokeServer()
print("gunnerino")
for i,v in pairs(guns:GetChildren()) do
	
	local gun = fpsModule.new(v.Name)
	gun.ammoData = ammoData
	
	table.insert(newGuns,#newGuns+1,gun)
	
end
print("viewmodelino")
for i,v in pairs(cam:GetChildren()) do
	
	if v.Name == "viewModel" then
		
		v:Destroy()
		
	end
	
end
print("after viewmodelino")
local working
print("printerino 1")
local function equip(gun)
	
	if working then return end
	
	working = true
	
	if gun.currentGun ~= gun then
		
		if gun.equipped then
			
			gun:Remove()
			
		end
		
		gun:Equip(gun)
		
	end
	
	working = false
	
end
print("printerino 2")
uis.InputBegan:Connect(function(key,gpe)
	
	if player.Character then
	
		if key.UserInputType == Enum.UserInputType.MouseButton1 then
			
			fpsModule:Fire(true)
			
		end
	
	end
	print(ownedGuns[2])
	if key.KeyCode == Enum.KeyCode.One and ownedGuns[1] then
		
		equip(ownedGuns[1])
		
	elseif key.KeyCode == Enum.KeyCode.Two then
		print("equipped")
		equip(ownedGuns[2])
		
	elseif key.KeyCode == Enum.KeyCode.Three and ownedGuns[3] then
		
		equip(ownedGuns[3])
		
	elseif key.KeyCode == Enum.KeyCode.R then
		
		fpsModule:Reload()
		
	elseif key.KeyCode == Enum.KeyCode.F then
		
		fpsModule:Inspect()
		
	end
	
end)

uis.InputEnded:Connect(function(key,gpe)
	
	if gpe then return end
	
	if player.Character then
		
		if key.UserInputType == Enum.UserInputType.MouseButton1 then
			
			fpsModule:Fire(false)
			
		end
		
	end
	
end)
print("printerino 3")
runService.RenderStepped:Connect(function(deltaTime)
	
	fpsModule:Update(deltaTime)
	
end)

Any help is appreciated. (yes, interesting choice of words for printing)

2 comments

0

Are you waiting long enough to receive any infinite yield warnings? I'm just wondering, because if you get no errors, the error is either in the module itself, or the fact that the module you're waiting for does not exist

0

The print that prints the module's name does print correctly, and there are no infinite yield warnings, and if the module was erroring then it would actually show up right?