We are working on an FPS game and right now we are facing some issues with the reloading animation. This animation is done on the view model. The exact issue is that the animation seems to change the position of the view model as soon as the animation has completed.
We have figured out why its happening but can’t seem to find the solution. We all know that as the player moves, his arms move along and which I feel is affecting the animation. Because the moment we press the key to reload and depending on what position your arm is in, the animation behaves accordingly and hence changing the idle position when it’s completed.
The gun is at the bottom right corner of the screen but when we press the reload key and the animation is done, the gun moves either to the bottom center or bottom left or moves forward in the view model or any random pos.
- So how can I fix this?
- Also, how can I set the animation to play the same regardless of the roblox player model type(R15 with different heights).
We are using the RightUpper Arm to set the position for the ViewModel.
PlayerUpperTorso = Player Character’s Torso and UpperTorso = ViewModel’s Torso
Here’s the script that we are using:
elseif not Player.Backpack:FindFirstChild("BluePelletGun") and Player.Team == Teams[1] then
Joint = Instance.new("Motor6D")
UpperTorso = viewModel:FindFirstChild("UpperTorso")
HandleOfWeapon = viewModel:FindFirstChild("BluePelletGun").Handle
if UpperTorso:FindFirstChild("Handle") then
UpperTorso:FindFirstChild("Handle"):Destroy()
end
-- This part affects the position of the reloading animation
repeat
wait(.01)
PlayerUpperTorso = Player.Character:WaitForChild("RightUpperArm")
UpperTorso.CFrame = PlayerUpperTorso.CFrame * CFrame.new(0,0,0)
until
PlayerUpperTorso ~= nil
-- till here
Joint.Parent = UpperTorso
Joint.Name = "Handle"
Joint.Part0 = UpperTorso
Joint.Part1 = HandleOfWeapon
end
repeat
wait(.01)
RelAnimate = viewModel.Humanoid.Animator:LoadAnimation(RelaodAnim)
until
RelAnimate ~= nil`