I am in the midst of trying to create my own FPS framework and I am currently following EgoMooses guide on how to create the first person aspect of a FPS shooter, and I am stuck on how to play the animation of the viewmodel and the gun.
When I play the Animation that I made for the viewmodel, it doesn’t appear like it was in the animation editor.
Sorry if this is the wrong topic, but someone told me this issue has something to do with my code
Expected behavior
Actual behavior in game
Viewmodel/gun model pose before I add animations
Current Code:
local player = game.Players.LocalPlayer
local remoteEvents = game.ReplicatedStorage:WaitForChild("RemoteEvents")
local run = game:GetService("RunService")
local char = script.Parent
local cam = workspace.Camera
local Revolver = game.ReplicatedStorage:WaitForChild("Revolver"):Clone()
Revolver.Parent = workspace
player.CameraMode = Enum.CameraMode.LockFirstPerson
cam.FieldOfView = 90
local arms = game.ReplicatedFirst.Viewmodel:Clone()
arms.Parent = cam
Revolver.Parent = arms
local joint = Instance.new("Motor6D");
joint.C0 = CFrame.new(0, -1, -5)
joint.Part0 = arms.CameraBone
joint.Part1 = Revolver.Handle
joint.Parent = arms.CameraBone
remoteEvents.setup:FireServer(Revolver)
local Idle = game.ReplicatedStorage:WaitForChild("Animation")
local Anim = arms.AnimationController.Animator:LoadAnimation(Idle)
Anim:Play()
local function onUpdate(dt)
arms.CameraBone.CFrame = cam.CFrame
remoteEvents.tiltAt:FireServer(math.asin(cam.CFrame.LookVector.y))
end
run.RenderStepped:Connect(onUpdate)