Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how to have different animations for Button1Down and Button1Up?

This is my first approach but this didn't work.

local mouse = game.Players.LocalPlayer:GetMouse()
local Wield = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Wield)
local Lunge = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Lunge)
local Slash = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Slash)

script.Parent.Equipped:Connect(function(mouse)
    Wield:Play()
        mouse.Button1Down:Connect(function()
            Lunge:Play()
        end)

        mouse.Button1Up:Connect(function()
            Slash:Play()
        end)
end)

1 answer

✓ Accepted answer

Use UserInputService.

script.Parent.Equipped:Connect(function()
    game:GetService(“UserInputService”).InputBegan:Connect(function(input, processed)
          if not processed then
              if input.UserInputType == Enum.UserInputType.MouseButton1 then
              end
          end
    end)

    game:GetService(“UserInputService”).InputEnded:Connect(function(input, processed)
          if not processed then
              if input.UserInputType == Enum.UserInputType.MouseButton1 then
              end
          end
    end)
end)

1 comment

0

i dont quite understand this. will u please explain? sorry

This discussion is preserved as it was. New answers, comments, and votes are closed.