I’ve been implementing animations to my gun for a few days and I encountered a problem: when the gun is given from replicated storage, all animations fail to load on a character (this problem does not appear in case of a gun being in starter pack). Is there a way to fix this problem?
here’s the script for better understanding
script.Parent.Equipped:Connect(function()
humanoid = script.Parent.Parent.Humanoid
player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
char = script.Parent.Parent
equipAnim = char:WaitForChild("Humanoid"):LoadAnimation(script:WaitForChild("EquipAnim"))
idleAnim = char:WaitForChild("Humanoid"):LoadAnimation(script:WaitForChild("IdleAnim"))
reloadAnim = char:WaitForChild("Humanoid"):LoadAnimation(script:WaitForChild("ReloadingAnim"))
braceaimingAnim = char:WaitForChild("Humanoid"):LoadAnimation(script:WaitForChild("BraceAimingAnim"))
aimingAnim = char:WaitForChild("Humanoid"):LoadAnimation(script:WaitForChild("AimingAnim"))
braceshootingAnim = char:WaitForChild("Humanoid"):LoadAnimation(script:WaitForChild("BraceShootingAnim"))
shootingAnim = char:WaitForChild("Humanoid"):LoadAnimation(script:WaitForChild("ShootingAnim"))
rootPart = script.Parent.Parent.HumanoidRootPart
mouse = player:GetMouse()
equipped = true
equipAnim:Play(transitionTime)
idleAnim:Play(transitionTime)
if reloadEvent == nil then
reloadEvent = ReloadAnimEvent.OnClientEvent:Connect(function()
reloadAnim:Play(transitionTime)
end)
end
end)