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()
tool.Activated:Connect(function()
local ru = tool.RodzajUchwytu.Value
local rg = tool.RodzajGlowy.Value
remote:FireServer(plr,mouse.Hit.p,mouse.Target,ru,rg)
end)
here is the server event it is calling:
local remote = game.ReplicatedStorage.Remotes.NoweSciecie
remote.OnServerEvent:Connect(function(plr,pozycja,segment,badyl,glowa)
local module = require(game.ServerScriptService.Siekiery.Scinanie)
module.noweSciecie(pozycja,segment,badyl,glowa)
end)
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 = Instance.new("Part",segment)
local twardosc = treemodule.twardosc
local silasiekiery
local tablezespecialdrzewami = {}
for i,v in pairs(glowamodule.specialtreeclasses) do
table.insert(tablezespecialdrzewami,v)
end
if table.find(tablezespecialdrzewami,segment.Parent.RodzajDrzewa.Value) then
silasiekiery = glowamodule.specialtreemoc
else
silasiekiery = glowamodule.moc
end
local length = twardosc/250 * silasiekiery
sciecie.Size = Vector3.new(segment.Size.X + 0.02,0.15,length)
local nwmjaknazwac = segment.Size.Z-0.02 / 2
local przesuniecie = Vector3.new(0,0,nwmjaknazwac)
sciecie.CFrame = segment.CFrame * CFrame.new(przesuniecie)
sciecie.Anchored = true
sciecie.Color = Color3.fromRGB(255,255,255)
sciecie.Reflectance = 1 sciecie.CanCollide = false
local maxlength = segment.Size.X + 0.02
end
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