(not sure which category to put this under since it has both scripting & animating)
Alright, So im trying to animate a viewmodel but currently it isnt going as planned
im moving the player’s arms onto a part that acts as a fake uppertorso that follows the camera
But coming now to animating it plays the viewmodel animation on the actual players arms.
(client)
(Server)
even before this i was having issues with attaching the gun to the viewmodel as right now i have to attach it to the character’s uppertorso on server but attach it to the viewmodel’s fake torso on client.
I have this current code to “do this”
(Client)
local function Equipped()
Character = Tool.Parent
if Vm and LastCharacter and LastCharacter ~= Character then
Vm = ViewmodelModule.Setup(Character)
end
if not Vm then
Vm = ViewmodelModule.Setup(Character)
end
Vm:BindArms()
repeat task.wait() until GunMotor.Part1 ~= nil
GunMotor.Part0 = Vm.FTorso
Animator = Character:FindFirstChildWhichIsA("Humanoid"):WaitForChild("Animator")
LoadedHoldAnimation = Animator:LoadAnimation(HoldAnimation)
LoadedHoldAnimation:Play()
end
local function Unequipped()
LastCharacter = Character
Character = nil
GunMotor.Part0 = nil
Vm:UnBindArms()
if LoadedHoldAnimation then LoadedHoldAnimation:Stop() end
end
(Server)
local function OnEquip()
local Character = Tool.Parent
GunWeld.Part0 = Character:FindFirstChild("UpperTorso")
RCP.FilterDescendantsInstances = {Character}
end
local function OnUnequip()
--GunWeld.Part0 = nil
RCP.FilterDescendantsInstances = {}
end
Now the issue i have with this is that it attaches to the character, not the viewmodel when first pulling out the gun, even after pulling out the gun it seems to fly between the viewmodel and the characters hands position on server
Also if this wasnt dashed out
--GunWeld.Part0 = nil -- Server
it would never attach to the viewmodel even though i have
repeat task.wait() until GunMotor.Part1 ~= nil -- Client