Hello, I’ve recently been having issues with the equipped function. It’s incredibly frustrating.
Here’s my code for reference:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local Tool = script.Parent
local Animations = require(Tool.Animations)
local GunSettings = require(Tool.GunSettings)
local SYS = ReplicatedStorage.SYS
local GunModels = SYS.GunModels
local GunEvents = SYS.GunEvents
------------------------------------------------------------------
Tool.Equipped:Connect(function()
if not GunModels:FindFirstChild(Tool.Name) then error('No gun model matching '..Tool.Name) end
local Mdl = GunModels:FindFirstChild(Tool.Name)
local Char = Tool.Parent
local Humanoid = Char.Humanoid
------------------------------------------------------------------
if (Humanoid:FindFirstChild('Animator')==nil) then warn("ERROR: No animator detected") return end
local Animator = Humanoid:FindFirstChild('Animator')
------------------------------------------------------------------
print("Loading animations")
local Equip = Instance.new("Animation")
Equip.Parent = Char.Humanoid
Equip.AnimationId = Animations.Equip
Equip = Animator:LoadAnimation(Equip)
local Stance = Instance.new("Animation")
Stance.Parent = Char.Humanoid
Stance.AnimationId = Animations.Stance
Stance = Animator:LoadAnimation(Stance)
Stance.Looped = true
local Walk = Instance.new("Animation")
Walk.Parent = Char.Humanoid
Walk.AnimationId = Animations.Walk
Walk = Animator:LoadAnimation(Walk)
local Run = Instance.new("Animation")
Run.Parent = Char.Humanoid
Run.AnimationId = Animations.Run
Run = Animator:LoadAnimation(Run)
local Reload = Instance.new("Animation")
Reload.Parent = Char.Humanoid
Reload.AnimationId = Animations.Reload
Reload = Animator:LoadAnimation(Reload)
print('Animations loaded')
------------------------------------------------------------------
Mdl = Mdl:Clone()
Mdl.Parent = Char
local weld = Instance.new("Weld", Mdl.Grip)
weld.Part0 = Mdl.Grip
weld.Part1 = Char['Right Arm']
weld.C0 = CFrame.new()
end)
Does anyone have any clue what’s happening?