Module code did not return exactly one value

my script isint working correctly
can anybody help me?

local Item = script.Parent
local ItemMain = require(game.ServerScriptService.ItemMain)

Item.Interaction.ProximityPrompt.Triggered:Connect(function(player)
	ItemMain.PickUpItem(player, Item, "DamagedWheelTool")
end)

this one is from the car and it works fine

local Vehicle = script.Parent

local VehicleMain = require(game.ServerScriptService.VehicleMain)

VehicleMain.SetColor(Vehicle)
VehicleMain.SetNumberPlate(Vehicle)
VehicleMain.SetRoofrack(Vehicle.Body.Roofrack)
VehicleMain.SetInventory(Vehicle)

for _, wheel in pairs(Vehicle.Wheels:GetChildren()) do
	if wheel:IsA("Model") then
		if string.match(wheel.Name, "Wheel") then
			VehicleMain.SetWheel(Vehicle, wheel)
			task.spawn(function()
				while task.wait() do
					VehicleMain.UpdateWheel(Vehicle, wheel)
				end
			end)
		end
	end
end

The issue lies in your modules can we see them ?

here is the module

--local VehicleHandling = require(game.ServerScriptService.VehicleHandling) -- ignore this part
local Tools = game.ServerStorage.Tools
local Items = game.ServerStorage.Items

local ItemMain = {}

function ItemMain.PickUpItem(player, item, tool)
	if player.Character.Humanoid.Health > 0 then
		local PickUpSound = game.ServerStorage.Sounds.Items.PickUp:Clone()
		PickUpSound.Parent = item.Interaction
		PickUpSound.RollOffMaxDistance = 50
		PickUpSound.RollOffMinDistance = 2
		PickUpSound.RollOffMode = Enum.RollOffMode.InverseTapered
		PickUpSound.PlayOnRemove = true
		local ToolClone = Tools[tool]:Clone()
		if player.Character:FindFirstChildWhichIsA("Tool") then
			ToolClone.Parent = player.Backpack
		else
			ToolClone.Parent = player.Character
		end
		task.wait(.005)
		item:Destroy()
	end
end

return

oh wait i already see the error lol i only had

return

instead of

return ItemMain
2 Likes

yeah, you should check more for tiny issues especially module errors cause they’re annoying

yea true i only made the tiniest mistake ever lol