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

I play the animation but the character's arm that is holding the gun stay still. how can I fix this?

Asked by 6 years ago

I edited this script to have bullet drop and the slide to come back when you fire it but cant even figure out how to have a animation play when you equip the gun. Its to make the character pull out the gun but when ever I change the equip animation it would just end up having the arm of the character holding the gun stay still but play the animation. Is there any way to fix this?

function OnEquipped(mouse)
    RecoilAnim = WaitForChild(Tool, 'Recoil')
    FireSound  = WaitForChild(Handle, 'FireSound')

    MyCharacter = Tool.Parent
    MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
    MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
    MyTorso = MyCharacter:FindFirstChild('Torso')
    MyMouse = mouse
    WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
    if WeaponGui and MyPlayer then
        WeaponGui.Parent = MyPlayer.PlayerGui
        UpdateAmmo(AmmoInClip)


        wait(0.8)
        script.Parent.Handle.EquipSound:Play()
        script.Parent.Bolt.Transparency = 1
        script.Parent.Bolt2.Transparency = 0
        wait(0.2)
        script.Parent.Bolt.Transparency = 0
        script.Parent.Bolt2.Transparency = 1
        wait(0.25)
    end
    if RecoilAnim then
        RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim)
    end

    if MyMouse then
        -- Disable mouse icon
        MyMouse.Icon = "http://www.roblox.com/asset/?id=18662154"
        MyMouse.Button1Down:connect(OnMouseDown)
        MyMouse.Button1Up:connect(OnMouseUp)
        MyMouse.KeyDown:connect(OnKeyDown)
    end
end

Answer this question