Attempted to call require with invalid argument(s), but there is an argument?

so im trying to make an axe script for my tree game. for the axe i need mouse target, position of mouse on the target, type of axe head and type of axe handle.
so the script works like this:
LocalScript in the Axe calls a FireServer() → the FireServer() fires a Module Function → the module function creates a cut

i mean its supposed to work like that but something ofc is not working.

error i am getting: Attempted to call require with invalid argument(s)
on this line
local badylmodule = require(game.ServerScriptService.Siekiery.RodzajeUchwytow:FindFirstChild(badyl))

so here is the local script that calls the server event:

local tool = script.Parent

local remote = game.ReplicatedStorage.Remotes.NoweSciecie

local plr = game.Players.LocalPlayer

local mouse = plr:GetMouse()


local ru = tool.RodzajUchwytu.Value

local rg = tool.RodzajGlowy.Value



here is the server event it is calling:
local remote = game.ReplicatedStorage.Remotes.NoweSciecie


local module = require(game.ServerScriptService.Siekiery.Scinanie)



and here is the module:
local module = {}

module.noweSciecie = function(pozycja,segment,badyl,glowa)
	local badylmodule = require(game.ServerScriptService.Siekiery.RodzajeUchwytow:FindFirstChild(badyl))
	local glowamodule = require(game.ServerScriptService.Siekiery.RodzajeGlow:FindFirstChild(glowa))
	local treemodule = require(game.ServerScriptService.Drzewa.RodzajeDrzew:FindFirstChild(segment.Parent.RodzajDrzewa.Value))
	local sciecie ="Part",segment)
	local twardosc = treemodule.twardosc
	local silasiekiery
	local tablezespecialdrzewami = {}
	for i,v in pairs(glowamodule.specialtreeclasses) do
	if table.find(tablezespecialdrzewami,segment.Parent.RodzajDrzewa.Value) then
		silasiekiery = glowamodule.specialtreemoc
		silasiekiery = glowamodule.moc
	local length = twardosc/250 * silasiekiery
	sciecie.Size = + 0.02,0.15,length)
	local nwmjaknazwac = segment.Size.Z-0.02 / 2
	local przesuniecie =,0,nwmjaknazwac)
	sciecie.CFrame = segment.CFrame *
	sciecie.Anchored = true
	sciecie.Color = Color3.fromRGB(255,255,255)
	sciecie.Reflectance = 1 sciecie.CanCollide = false
	local maxlength = segment.Size.X + 0.02

return module

i know the module doesnt make sense and its not gonna work anyways but i atleast want it to work (i mean fire and dont give any errors). im gonna take care of the rest later

1 Like

Probably that it couldn’t find the ModuleScript.

Have you tried printing the path to check it isn’t nil?


Double check it is a ModuleScript, not a regular script, and that printing the path as shown above directly above your require line prints what you expect it to.

ima try that
also i have played your rubiks game rn and got a world record, nice game

it prints nil for some reason. could it be because of the local script that fires the fireserver with all the variables?

If it prints nil, it means the FindFirstChild bit didn’t find it. It might be worth double checking the name, checking that it’s in the RodzajeUchwytow folder when you actually run the game in studio.