This is the script that’s erroring:
local WeaponFramework = game:GetService("ReplicatedStorage"):WaitForChild("WeaponFramework")
local WeaponsFolder = game:GetService("ReplicatedStorage"):WaitForChild("Weapons")
local WeaponModule = require(WeaponFramework.Modules.WeaponModule)
local EquipWeaponEvent = WeaponFramework.Events.EquipWeapon
local function TransferServer(Player, WeaponModel, Viewmodel) --Local script notifies this script when the player equips and stuff and this script toggles to server side things. Hard to explain sorry.
local Character = Player.Character or Player.CharacterAdded:Wait() or workspace:FindFirstChild(Player.Name)
local Humanoid = Character.Humanoid or Character:WaitForChild("Humanoid")
local AnimationsFolder = WeaponModel.Animations
local HoldingAnimationServer = AnimationsFolder:FindFirstChild("HoldingAnimationServer")
local LoadedHoldingAnimationServer = Viewmodel.AnimationController:LoadAnimation(HoldingAnimationServer)
LoadedHoldingAnimationServer:Play()
end
EquipWeaponEvent.OnServerEvent:Connect(TransferServer)
This is the local script im firing the event from:
local Player = game:GetService("Players").LocalPlayer
local mouse = Player:GetMouse()
local UIS = game:GetService("UserInputService")
local WeaponFramework = game:GetService("ReplicatedStorage"):WaitForChild("WeaponFramework")
local WeaponsFolder = game:GetService("ReplicatedStorage"):WaitForChild("Weapons")
local EquipWeaponEvent = WeaponFramework.Events.EquipWeapon
local WeaponModule = require(WeaponFramework.Modules.WeaponModule)
local VM = WeaponFramework.Viewmodel
local ClickedKeyBind = false
local Equipped = false
local Slot = 0
--Scroll wheel weapons
local SWWeapons = {
[Enum.KeyCode.One] = "FlashLight",
[Enum.KeyCode.Two] = "Pistol"
}
--Keybind weapons
local KBWeapons = {
[Enum.KeyCode.One] = "One",
[Enum.KeyCode.Two] = "Two"
}
local function KeyBindEquip(input, gp)
if not gp then
if KBWeapons[input.KeyCode] then
local ChosenWeapon = SWWeapons[input.KeyCode]
local CurrentWeapon = WeaponsFolder[ChosenWeapon]
if CurrentWeapon then
if ClickedKeyBind == false then
ClickedKeyBind = true
local ClonedVM = VM:Clone()
local ClonedWN = CurrentWeapon:Clone()
local AnimFolder = ClonedWN.Animations
local WeaponHoldAnimClient = AnimFolder.HoldingAnimationClient
WeaponModule.EnableViewmodel(ClonedVM)
WeaponModule.Equip(ClonedWN, ClonedVM, WeaponHoldAnimClient)
WeaponModule.Weld(ClonedWN)
Equipped = true
EquipWeaponEvent:FireServer(ClonedWN, ClonedVM)
UpdaterFunction = game:GetService("RunService").RenderStepped:Connect(function(dt) --This is ugly
WeaponModule.UpdateViewmodel(ClonedVM, dt)
end)
else
ClickedKeyBind = false
Equipped = false
UpdaterFunction:Disconnect()
WeaponModule.DisableViewmodel()
end
end
end
end
end
UIS.InputBegan:Connect(KeyBindEquip)
Im making an FPS framework and trinyg to handle the more basic stuff on 2 scripts
Cheers!