- What do you want to achieve?
So I’ve been working on transferring a lot of my client scripts onto modules to protect them. I have done this before when making a module inspired by fastcast.
- What is the issue?
When adding a function to be called in the module, the outliner gives me the error attempted to call missing method 'equiptWeapon' of table which if I correct means that they module can’t find this function in the table.
- What solutions have you tried so far?
I’ve have checked for an syntax errors or formatting errors with the table but can’t see anything.
I will send my code here if anyone wants to look into it.
Module Script Code
local player = game.Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Root = Character:WaitForChild("HumanoidRootPart")
local hud = player.PlayerGui:WaitForChild("Hud")
local RS = game:GetService("ReplicatedStorage")
local Animations = RS.Guns:FindFirstChild("Animations")
local camera = game.Workspace.CurrentCamera
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local tweenservice = game:GetService("TweenService")
local Setup = {}
function Setup.new(inventory)
local Inventory = inventory
local aimCf = CFrame.new()
local preSlot = nil
local Map = false
local canFocus = false
local focus = nil
local isAiming = false
local Debounce = false
local currentSway = 1
local swayAmount = nil
local aimSway = nil
local swayCF = CFrame.new()
local lastCamCF = CFrame.new()
local Ragdoll = false
local PreSlot = nil
local frameWork = {}
frameWork.Module = nil
frameWork.ViewModel = nil
frameWork.CurrentSlot = 1
function frameWork:equiptWeapon(input)
local slot = Inventory[input]
local viewModelFolder = game.ReplicatedStorage.ViewModels
local moduleFolder = game.ReplicatedStorage.Guns.Modules
for i, v in pairs(camera:GetChildren()) do
if v:IsA("Model") then
v:Destroy()
end
end
if moduleFolder:FindFirstChild(slot) then
self.Module = require(moduleFolder:FindFirstChild(slot))
--GunEvent:FireServer(input)
if viewModelFolder:FindFirstChild(slot) then
self.ViewModel = viewModelFolder:FindFirstChild(slot):Clone()
self.ViewModel.Parent = camera
swayAmount = self.Module.normSway
aimSway = self.Module.aimSway
end
end
end
return frameWork
end
return Setup
Call of Module on client
local Table = {"ShanseiC44", "FireArm"}
local Framwork = require(game.Workspace.FrameWorkModual)
Framwork.new(Table)
Framwork:equiptWeapon(1)
If you need anymore information about my code or script let me know. Any help is much appriciated ![]()