Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Viewmodel Animations not running as intended?

Asked by
colivs 2
4 years ago

Hey, i'm remaking my FPS Framework with new rigs and instead of creating CFrame animations, i use regular animations. I've noticed that the arm's (which are rigged correctly) don't play animations when a animation is loaded and played.

I also used print(anim1.IsPlaying)and it returned as true.

Here is some images to help.

Print returned as true :https://cdn.discordapp.com/attachments/610196793522913301/618129133871824916/unknown.png

Proof that the animation works in Moon Animation Suite: https://cdn.discordapp.com/attachments/610196793522913301/618129464454283268/unknown.png

Entire Code: (as of 9/2)

--//Main Variables
local player = game.Players.LocalPlayer
local cam = workspace.CurrentCamera
local run = game:GetService("RunService")
local reps = game:GetService("ReplicatedStorage")
local model = reps:WaitForChild("Arms"):Clone()
game:GetService("StarterPlayer").CameraMode = Enum.CameraMode.LockFirstPerson


--//Animation Variables
local Animations = script:WaitForChild("Animations")
local Fire = nil
local Reload = nil
local Arms = nil



local loadout ={
    Gun = script:WaitForChild("Weapon").Value;
}

local GunSettings = require(reps:WaitForChild("GunModules"):FindFirstChild(loadout.Gun))

--//Gun Variables
local MaxAmmo = GunSettings.MaxAmmo
local Gun = nil

local function CreateArms()

for i,v in pairs (model:GetChildren()) do
    if v:IsA("BasePart") then
       if v ~= model.PrimaryPart then
          local weld = Instance.new("Weld")
          weld.Part0 = model.PrimaryPart
          weld.Part1 = v
          weld.C0 = model.PrimaryPart.CFrame:inverse()
          weld.C1 = v.CFrame:inverse()
         weld.Name = v.Name
         weld.Parent = model.PrimaryPart
        Arms = model
  end
 end
end

model.Parent = cam

spawn(function()
    run.RenderStepped:connect(function()
         model:SetPrimaryPartCFrame(cam.CFrame *CFrame.new(GunSettings.MainCFrame)) -- This is the position goes by X,Y,Z format
      end)
end)
end

local function CreateWeapon()
    if Arms ~= nil then
    Gun = reps:WaitForChild("Guns"):FindFirstChild(loadout.Gun):Clone()
    local weld = Instance.new("Weld")

    Gun.Parent = cam
    weld.Parent = Gun

    weld.Part0 = Gun
    weld.Part1 = Arms["Right Arm"]

    weld.C0 = CFrame.new(0,1,0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
    end
end


local function RenderAnimations()
    if Arms ~= nil then
    Idle = Animations:FindFirstChild("Idle")

    local anim1 = Arms:FindFirstChild("Humanoid"):LoadAnimation(Idle)

    anim1:Play()

    print(anim1.IsPlaying)
    CreateWeapon()
    end
end

CreateArms()
RenderAnimations()

Where everything is located: [https://cdn.discordapp.com/attachments/617898431561728001/617898626416508938/unknown.png]

0
Is it possible your arm are anchored? mbramblet 80 — 4y
0
Try Changing the roblox default idle animation and replacing it with your id Prestory 1395 — 4y
0
The Idle Animation is my own animation and ID, and also the arm's are not anchored they've been rigged properly. colivs 2 — 4y

Answer this question